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

Before Change


                l.reset_states()

    def set_previous(self, layer, connection_map={}):
        if self.nb_input != layer.nb_output:
            raise Exception("Cannot connect layers: "
                            "input count does not match output count.")
        if self.nb_input == 1:
            self.inputs[self.input_order[0]].set_previous(layer)
        else:
            if not connection_map:
                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



    Note: `Graph` can only be used as a layer
    (connect, input, get_input, get_output)
    when it has exactly one input and one output.
    """
    def __init__(self):
        self.namespace = set()  // strings
        self.nodes = OrderedDict()  // layer-like
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

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/autokeras
Commit Name: 1cda66554188c4504aa94d1bcffd4cef9ee8a997
Time: 2017-12-28
Author: jhfjhfj1@gmail.com
File Name: autokeras/utils.py
Class Name:
Method Name: copy_layer


Project Name: keras-team/keras
Commit Name: a637960fab61b66848a36e6a5caf0204c155af01
Time: 2018-05-01
Author: francois.chollet@gmail.com
File Name: keras/engine/sequential.py
Class Name: Sequential
Method Name: add