7f30b2403fadc4eaad48ceaf6154a626f477f8c8,autokeras/graph.py,Graph,produce_model,#Graph#,512

Before Change



    def produce_model(self):
        Build a new Keras model based on the current graph.
        input_tensor = Input(shape=get_int_tuple(self.input.shape[1:]))
        input_id = self.node_to_id[self.input]
        output_id = self.node_to_id[self.output]

        new_to_old_layer = {}

        node_list = deepcopy(self.node_list)
        node_list[input_id] = input_tensor

        node_to_id = deepcopy(self.node_to_id)
        node_to_id[input_tensor] = input_id

        for v in self._topological_order():
            for u, layer_id in self.reverse_adj_list[v]:
                layer = self.layer_list[layer_id]

                if isinstance(layer, (StubWeightedAdd, StubConcatenate)):
                    edge_input_tensor = list(map(lambda x: node_list[x],
                                                 self.layer_id_to_input_node_ids[layer_id]))
                else:
                    edge_input_tensor = node_list[u]

                new_layer = to_real_layer(layer)
                new_to_old_layer[new_layer] = layer

                temp_tensor = new_layer(edge_input_tensor)
                node_list[v] = temp_tensor
                node_to_id[temp_tensor] = v
        model = Model(input_tensor, node_list[output_id])
        for layer in model.layers[1:]:
            if not isinstance(layer, (Activation, Dropout, Concatenate)):

After Change



        return ret

    def produce_model(self):
        Build a new Keras model based on the current graph.
        input_tensor = Input(shape=self.input_shape)
        topo_node_list = self._topological_order()
        output_id = topo_node_list[-1]
        input_id = topo_node_list[0]

        new_to_old_layer = {}

        node_list = deepcopy(self.node_list)
        node_list[input_id] = input_tensor

        node_to_id = deepcopy(self.node_to_id)
        node_to_id[input_tensor] = input_id

        for v in topo_node_list:
            for u, layer_id in self.reverse_adj_list[v]:
                layer = self.layer_list[layer_id]

                if isinstance(layer, (StubWeightedAdd, StubConcatenate)):
                    edge_input_tensor = list(map(lambda x: node_list[x],
                                                 self.layer_id_to_input_node_ids[layer_id]))
                else:
                    edge_input_tensor = node_list[u]

                new_layer = to_real_layer(layer)
                new_to_old_layer[new_layer] = layer

                temp_tensor = new_layer(edge_input_tensor)
                node_list[v] = temp_tensor
                node_to_id[temp_tensor] = v
        model = Model(input_tensor, node_list[output_id])
        for layer in model.layers[1:]:
            if not isinstance(layer, (Activation, Dropout, Concatenate)):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 30

Instances


Project Name: jhfjhfj1/autokeras
Commit Name: 7f30b2403fadc4eaad48ceaf6154a626f477f8c8
Time: 2018-05-26
Author: jin@tamu.edu
File Name: autokeras/graph.py
Class Name: Graph
Method Name: produce_model


Project Name: keras-team/autokeras
Commit Name: 7f30b2403fadc4eaad48ceaf6154a626f477f8c8
Time: 2018-05-26
Author: jin@tamu.edu
File Name: autokeras/graph.py
Class Name: Graph
Method Name: produce_model


Project Name: jhfjhfj1/autokeras
Commit Name: 4b83c1070cebd0d996ba2cc69779dcb66d5d0032
Time: 2018-05-29
Author: jhfjhfj1@gmail.com
File Name: autokeras/graph.py
Class Name: Graph
Method Name: produce_model