1cf4c73059ba4435f37a93a316edbd426263cbf0,pytorch2keras/converter.py,,pytorch_to_keras,#,141

Before Change


    outputs = []

    input_index = 0
    model_inputs = dict()
    for node in nodes:
        node_inputs = list(node.inputs())
        node_input_names = []
        for node_input in node_inputs:
            if node_input.node().scopeName():
                node_input_names.append(get_node_id(node_input.node()))

        if len(node_input_names) == 0:
            if len(node_inputs) > 0:
                if node_inputs[0] in model_inputs:
                    node_input_names.append(model_inputs[node_inputs[0]])
                else:
                    input_name = "input{0}".format(input_index)
                    if input_name not in layers:
                        continue
                    node_input_names.append(input_name)
                    input_index += 1
                    model_inputs[node_inputs[0]] = input_name

        node_type = node.kind()
        // print(dir(node))

        node_scope_name = node.scopeName()

After Change


    print("Graph outputs:", graph_outputs)


    graph_inputs = [n.uniqueName() for n in trace.graph().inputs()]
    print("Graph inputs:", graph_inputs)

    // Collect model state dict
    state_dict = _unique_state_dict(model)
    if verbose:
        print("State dict:", list(state_dict))

    import re
    import keras
    from keras import backend as K
    K.set_image_data_format("channels_first")

    layers = dict()
    keras_inputs = []
    for i in range(len(args)):
        layers["input{0}".format(i)] = keras.layers.InputLayer(
            input_shape=input_shapes[i], name="input{0}".format(i)
        ).output
        keras_inputs.append(layers["input{0}".format(i)])

    outputs = []

    input_index = 0
    model_inputs = ["input" + i for i in graph_inputs]

    for node in nodes:
        node_inputs = list(node.inputs())
        // print(node_inputs, model_inputs)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

Instances


Project Name: nerox8664/pytorch2keras
Commit Name: 1cf4c73059ba4435f37a93a316edbd426263cbf0
Time: 2018-12-20
Author: nerox8664@gmail.com
File Name: pytorch2keras/converter.py
Class Name:
Method Name: pytorch_to_keras


Project Name: open-mmlab/mmdetection
Commit Name: 2d2e5c6f42b6f4b8ab4f68985b1fd7823e3be505
Time: 2021-01-13
Author: 35596075+congee524@users.noreply.github.com
File Name: docs/stat.py
Class Name:
Method Name:


Project Name: soft-matter/trackpy
Commit Name: cc410f68b6c1d1417322ec02e22ea7713ca0bc48
Time: 2020-03-18
Author: ruben@lighthacking.nl
File Name: trackpy/locate_functions/brightfield_ring.py
Class Name:
Method Name: locate_brightfield_ring