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


            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: 8

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: pymc-devs/pymc3
Commit Name: e3fd56b08ed5c4d7247a147c3fab7c0fe59e9a0e
Time: 2019-02-16
Author: luciano.paz.neuro@gmail.com
File Name: pymc3/distributions/mixture.py
Class Name: Mixture
Method Name: comp_dists


Project Name: mittagessen/kraken
Commit Name: 9f200d963b9646fb50326f7cf6788021ddfe955d
Time: 2018-04-08
Author: mittagessen@l.unchti.me
File Name: kraken/lib/models.py
Class Name:
Method Name: load_any