ffed6ce438fc1ebdc8054d307ffdfce4bbf2f7f1,onnx_coreml/_transformers.py,GatherConstantRemover,__call__,#GatherConstantRemover#Any#,770

Before Change


    def __call__(self, graph):  // type: (Graph) -> Graph
        nodes_to_be_removed = []
        for node in graph.nodes:
            if node.op_type == "Gather" and len(node.parents) == 0 and \
                node.inputs[0] in node.input_tensors and node.inputs[1] in node.input_tensors:

                nodes_to_be_removed.append(node)
                data = node.input_tensors[node.inputs[0]]
                idx = node.input_tensors[node.inputs[1]]
                axis = node.attrs.get("axis", 0)
                x = np.take(data, idx, axis=axis)
                graph.shape_dict[node.outputs[0]] = x.shape
                for child_node in node.children:
                    child_node.parents.remove(node)
                    child_node.input_tensors[node.outputs[0]] = x

After Change


                            break

                for parent in node.parents:
                    parent.children.remove(node)

        transformed_nodes = []
        for node in graph.nodes:
            if node not in nodes_to_be_removed:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: onnx/onnx-coreml
Commit Name: ffed6ce438fc1ebdc8054d307ffdfce4bbf2f7f1
Time: 2019-09-03
Author: bhushan.s.94@gmail.com
File Name: onnx_coreml/_transformers.py
Class Name: GatherConstantRemover
Method Name: __call__


Project Name: biocore/scikit-bio
Commit Name: daf661c3edd949f8ac2cd70e4a725d9a055cc0c3
Time: 2016-06-27
Author: mcdonadt@colorado.edu
File Name: skbio/tree/_tree.py
Class Name: TreeNode
Method Name: shear


Project Name: autorope/donkeycar
Commit Name: c8e5a57b44aa57c820c87acb4521a44339680eac
Time: 2019-01-15
Author: tawnkramer@gmail.com
File Name: donkeycar/parts/network.py
Class Name: TCPServeValue
Method Name: send


Project Name: thenetcircle/dino
Commit Name: e58d85394b5bde82a277c21b46389d9cba96107d
Time: 2016-10-28
Author: oscar.eriks@gmail.com
File Name: dino/db/rdbms/handler.py
Class Name: DatabaseRdbms
Method Name: remove_current_rooms_for_user