def load_kalid_nnet2_model(graph, file_descr, nnet_name):
    input_name = 'Input'
    graph.add_node(input_name, name=input_name, kind='op', op='Parameter', parameters=None, shape=None)
    prev_layer_id = input_name
    all_components = load_components(file_descr, graph)
    used_layers = set()
    for layer_id in all_components:
        prev_node = Node(graph, prev_layer_id)
        if (prev_node.op == 'Parameter'):
            parameters = Node(graph, layer_id).parameters
            input_dim = read_token_value(parameters, b'<InputDim>')
            prev_node['shape'] = int64_array([1, input_dim])
        prev_node.add_output_port(0)
        Node(graph, layer_id).add_input_port(0)
        graph.create_edge(prev_node, Node(graph, layer_id), 0, 0, create_edge_attrs(prev_layer_id, layer_id, prev_layer_id))
        used_layers.add(prev_layer_id)
        prev_layer_id = layer_id
        log.debug('{} and {} were connected'.format(prev_layer_id, layer_id))
    output_layers = (graph.nodes - used_layers)
    add_outputs_identity(graph, output_layers, (lambda g, output, fake_output: g.create_edge(Node(g, output), Node(g, fake_output), 0, 0, create_edge_attrs(output, fake_output, output))))
def load_kalid_nnet2_model(graph, file_descr, nnet_name):
    input_name = 'Input'
    graph.add_node(input_name, name=input_name, kind='op', op='Parameter', parameters=None, shape=None)
    prev_layer_id = input_name
    all_components = load_components(file_descr, graph)
    used_layers = set()
    for layer_id in all_components:
        prev_node = Node(graph, prev_layer_id)
        if (prev_node.op == 'Parameter'):
            parameters = Node(graph, layer_id).parameters
            input_dim = read_token_value(parameters, b'<InputDim>')
            prev_node['shape'] = int64_array([1, input_dim])
        prev_node.add_output_port(0)
        Node(graph, layer_id).add_input_port(0)
        graph.create_edge(prev_node, Node(graph, layer_id), 0, 0, create_edge_attrs(prev_layer_id, layer_id, prev_layer_id))
        used_layers.add(prev_layer_id)
        prev_layer_id = layer_id
        log.debug('{} and {} were connected'.format(prev_layer_id, layer_id))
    output_layers = (graph.nodes - used_layers)
    add_outputs_identity(graph, output_layers, (lambda g, output, fake_output: g.create_edge(Node(g, output), Node(g, fake_output), 0, 0, create_edge_attrs(output, fake_output, output))))