44d558ad7f13251650f40475eef6652df59e4b09,keras/layers/containers.py,Graph,set_previous,#Graph#Any#Any#,254

Before Change


                raise Exception("Cannot attach multi-input layer: "
                                "no connection_map provided.")
            for k, v in connection_map.items():
                if k in self.inputs and v in layer.outputs:
                    self.inputs[k].set_previous(layer.outputs[v])
                else:
                    raise Exception("Invalid connection map.")

    def get_input(self, train=False):
        if len(self.inputs) == len(self.outputs) == 1:
            return self.inputs[self.input_order[0]].get_input(train)

After Change


            self.set_input()
        return self.layers[0].get_input(train)

    @property
    def input_shape(self):
        return self.layers[0].input_shape

    @property
    def input(self):
        return self.get_input()

    def get_weights(self):
        weights = []
        for layer in self.layers:
            weights += layer.get_weights()
        return weights

    def set_weights(self, weights):
        for i in range(len(self.layers)):
            nb_param = len(self.layers[i].trainable_weights) + len(self.layers[i].non_trainable_weights)
            self.layers[i].set_weights(weights[:nb_param])
            weights = weights[nb_param:]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: keras-team/keras
Commit Name: 44d558ad7f13251650f40475eef6652df59e4b09
Time: 2016-02-22
Author: Nicholas.Eggert@target.com
File Name: keras/layers/containers.py
Class Name: Graph
Method Name: set_previous


Project Name: keras-team/keras
Commit Name: c60e2dfbdbb49b383b159fba7f46810c7dcbbf34
Time: 2015-10-05
Author: makoto.matsuyama@gmx.com
File Name: keras/layers/core.py
Class Name: Layer
Method Name: set_previous


Project Name: pytorch/pytorch
Commit Name: e87ab2ac4d4f4d208a1dcbc21b584fe59bf18e5f
Time: 2021-03-15
Author: erjia@fb.com
File Name: torch/utils/data/decorator.py
Class Name: functional_datapipe
Method Name: __call__