f7b7edac5b9e329ffdda30d710f68db71d08e065,nni/common/graph_utils.py,TorchModuleGraph,_build_graph,#TorchModuleGraph#,624

Before Change


        _logger.debug(graph)
        // build output mapping, from output debugName to its node
        output_to_node = {x.debugName(): n for n in graph.nodes()
                          for x in n.outputs()}
        // build input mapping, from input debugName to its node
        input_to_node = {x.debugName(): n for n in graph.nodes()
                         for x in n.inputs()}

After Change


        // build input/output mapping, from input/output debugName to its node
        input_to_node = defaultdict(list)
        output_to_node = defaultdict(list)
        for node in graph.nodes():
            if node.kind() == CONSTANT_KIND:
                continue
            for x in node.outputs():
                if x.node().kind() == CONSTANT_KIND:
                    continue
                output_to_node[x.debugName()].append(node)
                assert len(output_to_node[x.debugName()]) <= 1, "One output cannot be generated by multiple nodes %s" % x.debugName()
            for x in node.inputs():
                if x.node().kind() == CONSTANT_KIND:
                    continue
                input_to_node[x.debugName()].append(node)

        // build module mapping, from module name to all nodes (as list) under this module scope
        module_to_nodes = defaultdict(list)
        // the mapping of function (non-module in forward) to nodes, key is scope name
        func_to_nodes = defaultdict(list)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: Microsoft/nni
Commit Name: f7b7edac5b9e329ffdda30d710f68db71d08e065
Time: 2020-11-22
Author: 38930155+chicm-ms@users.noreply.github.com
File Name: nni/common/graph_utils.py
Class Name: TorchModuleGraph
Method Name: _build_graph


Project Name: nerox8664/pytorch2keras
Commit Name: 5101a0fe2a89683ea3df8cb896610aaa3da04fb1
Time: 2019-01-01
Author: nerox8664@gmail.com
File Name: pytorch2keras/converter.py
Class Name:
Method Name: pytorch_to_keras


Project Name: Microsoft/nni
Commit Name: 5d2a59fd4cf708d285d0db8ff3522c9156d2c4a9
Time: 2020-08-12
Author: 49771382+zheng-ningxin@users.noreply.github.com
File Name: src/sdk/pynni/nni/_graph_utils.py
Class Name: TorchModuleGraph
Method Name: unpack_manually