bcf723a2f67a372e6b03a453149a82ecf2766fff,theanolm/network.py,Architecture,check_state,#Architecture#Any#,118

Before Change


                raise IncompatibleStateError(
                    "Parameter "arch.layers" is missing from neural network state.")
            // An ugly workaround to be able to save arbitrary data in a .npz file.
            try:
                dummy_dict = state["arch.layers"][()]
            except KeyError:
                dummy_dict = state["arch.layers"]
            state_layers = dummy_dict["data"]
            for layer1, layer2 in zip(self.layers, state_layers):
                if layer1["type"] != layer2["type"]:
                    raise IncompatibleStateError(

After Change


            h5_layers = state["arch/layers"]
            for layer_id, layer in enumerate(self.layers):
                h5_layer = h5_layers[str(layer_id)]
                for variable, values in layer.items():
                    if isinstance(values, list):
                        h5_values = h5_layer[variable]
                        for value_id, value in enumerate(values):
                            h5_value = h5_values.attrs[str(value_id)]
                            if value != h5_value:
                                raise IncompatibleStateError(
                                    "Neural network state has {0}={1}, while "
                                    "this architecture has {0}={2}.".format(
                                        variable, value, h5_value))
                    else:
                        h5_value = h5_layer.attrs[variable]
                        if values != h5_value:
                            raise IncompatibleStateError(
                                "Neural network state has {0}={1}, while "
                                "this architecture has {0}={2}.".format(
                                    variable, value, h5_value))

    def __init__(self, dictionary, architecture, batch_processing=True, profile=False):
        Initializes the neural network parameters for all layers, and
        creates Theano shared variables from them.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: senarvi/theanolm
Commit Name: bcf723a2f67a372e6b03a453149a82ecf2766fff
Time: 2015-12-24
Author: seppo.git@marjaniemi.com
File Name: theanolm/network.py
Class Name: Architecture
Method Name: check_state


Project Name: Microsoft/nni
Commit Name: 08af7771d1f1149f3da5a98bcdbf7e65abd409ba
Time: 2020-12-27
Author: Quanlu.Zhang@microsoft.com
File Name: nni/retiarii/strategies/tpe_strategy.py
Class Name: TPEStrategy
Method Name: run


Project Name: eth-cscs/reframe
Commit Name: 5a9bc8770361a36400a812ea6d141e6bafdf6544
Time: 2019-07-09
Author: bignamini@cscs.ch
File Name: reframe/core/pipeline.py
Class Name: RegressionTest
Method Name: check_performance