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

Before Change



        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: jazzband/django-debug-toolbar
Commit Name: e403821323d529980407c05da77409c7e1c5c2a0
Time: 2008-09-08
Author: rob@cogit8.org
File Name: debug_toolbar/panels/headers.py
Class Name: HeaderDebugPanel
Method Name: content


Project Name: markovmodel/PyEMMA
Commit Name: 044f5f26e1b661c74c6cb60aef2906a6e372a2f1
Time: 2018-09-10
Author: m.scherer@fu-berlin.de
File Name: doc/nbconvert_filter.py
Class Name: RemoveWidgetNotice
Method Name: preprocess_cell