def load_kalid_nnet1_model(graph, file_descr, name):
    prev_layer_id = 'Parameter'
    graph.add_node(prev_layer_id, name=prev_layer_id, kind='op', op='Parameter', parameters=None)
    output_layer = None
    while True:
        component_type = find_next_component(file_descr)
        if (component_type == end_of_nnet_tag.lower()[1:(- 1)]):
            break
        layer_o = read_binary_integer32_token(file_descr)
        layer_i = read_binary_integer32_token(file_descr)
        if (component_type == 'parallelcomponent'):
            prev_layer_id = load_parallel_component(file_descr, graph, prev_layer_id)
            find_end_of_component(file_descr, component_type)
            continue
        start_index = file_descr.tell()
        (end_tag, end_index) = find_end_of_component(file_descr, component_type)
        end_index -= len(end_tag)
        layer_id = graph.unique_id(prefix=component_type)
        graph.add_node(layer_id, parameters=get_parameters(file_descr, start_index, end_index), op=component_type, kind='op', layer_i=layer_i, layer_o=layer_o)
        if hasattr(graph, 'op_names_statistic'):
            graph.op_names_statistic[component_type] += 1
        prev_node = Node(graph, prev_layer_id)
        if (prev_node.op == 'Parameter'):
            prev_node['shape'] = int64_array([1, layer_i])
        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))
        prev_layer_id = layer_id
        output_layer = layer_id
        log.debug('{} (type is {}) was loaded'.format(prev_layer_id, component_type))
    assert (output_layer is not None), 'Output layer is not found in graph'
    add_outputs_identity(graph, [output_layer], (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_nnet1_model(graph, file_descr, name):
    prev_layer_id = 'Parameter'
    graph.add_node(prev_layer_id, name=prev_layer_id, kind='op', op='Parameter', parameters=None)
    output_layer = None
    while True:
        component_type = find_next_component(file_descr)
        if (component_type == end_of_nnet_tag.lower()[1:(- 1)]):
            break
        layer_o = read_binary_integer32_token(file_descr)
        layer_i = read_binary_integer32_token(file_descr)
        if (component_type == 'parallelcomponent'):
            prev_layer_id = load_parallel_component(file_descr, graph, prev_layer_id)
            find_end_of_component(file_descr, component_type)
            continue
        start_index = file_descr.tell()
        (end_tag, end_index) = find_end_of_component(file_descr, component_type)
        end_index -= len(end_tag)
        layer_id = graph.unique_id(prefix=component_type)
        graph.add_node(layer_id, parameters=get_parameters(file_descr, start_index, end_index), op=component_type, kind='op', layer_i=layer_i, layer_o=layer_o)
        if hasattr(graph, 'op_names_statistic'):
            graph.op_names_statistic[component_type] += 1
        prev_node = Node(graph, prev_layer_id)
        if (prev_node.op == 'Parameter'):
            prev_node['shape'] = int64_array([1, layer_i])
        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))
        prev_layer_id = layer_id
        output_layer = layer_id
        log.debug('{} (type is {}) was loaded'.format(prev_layer_id, component_type))
    assert (output_layer is not None), 'Output layer is not found in graph'
    add_outputs_identity(graph, [output_layer], (lambda g, output, fake_output: g.create_edge(Node(g, output), Node(g, fake_output), 0, 0, create_edge_attrs(output, fake_output, output))))