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

Before Change


            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: 7

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: pytorch/tutorials
Commit Name: a61996ae5406ddfee4ac65ab647ebe858fc16260
Time: 2018-09-17
Author: matthewinkawhich@gmail.com
File Name: beginner_source/chatbot_tutorial.py
Class Name:
Method Name: evaluateInput


Project Name: pytorch/tutorials
Commit Name: 69d978ed497856d05730c05564597e604713f5c4
Time: 2018-09-16
Author: minkawhich@fb.com
File Name: beginner_source/chatbot_tutorial.py
Class Name:
Method Name: evaluateInput