def load_components(file_descr, graph, component_layer_map=None):
    num_components = collect_until_token_and_read(file_descr, b'<NumComponents>')
    log.debug('Network contains {} components'.format(num_components))
    is_nnet3 = (False if (component_layer_map is None) else True)
    if (not is_nnet3):
        collect_until_token(file_descr, b'<Components>')
    all_components = list()
    name = ''
    for _ in range(num_components):
        if is_nnet3:
            name = collect_until_token_and_read(file_descr, b'<ComponentName>', np.string_)
        component_type = find_next_component(file_descr)
        if (component_type == end_of_nnet_tag.lower()[1:(- 1)]):
            break
        start_index = file_descr.tell()
        (end_tag, end_index) = find_end_of_component(file_descr, component_type)
        file_descr.seek(start_index)
        dim = 0
        dim_words = {b'<Dim>', b'<InputDim>'}
        for dim_word in dim_words:
            try:
                collect_until_token(file_descr, dim_word, size_search_zone=(end_index - start_index))
                cur_index = file_descr.tell()
                if (start_index < cur_index < end_index):
                    dim = read_binary_integer32_token(file_descr)
                    break
                else:
                    file_descr.seek(start_index)
            except Error:
                file_descr.seek(start_index)
        if is_nnet3:
            if (name in component_layer_map):
                layer_id = component_layer_map[name][0]
                for layer in component_layer_map[name]:
                    node = Node(graph, layer)
                    node['parameters'] = get_parameters(file_descr, start_index, end_index)
                    node['op'] = component_type
                    for (o_n_name, params) in node.get_outputs():
                        o_n = Node(graph, o_n_name)
                        if ((o_n['op'] == 'MemoryOffset') and (dim != 0)):
                            o_n['parameters']['element_size'] = int64_array([1, dim])
            else:
                raise Error('Something wrong with layer {}'.format(name))
        else:
            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')
        if hasattr(graph, 'op_names_statistic'):
            graph.op_names_statistic[component_type] += 1
        all_components.append(layer_id)
        log.debug('{} (type is {}) was loaded'.format(layer_id, component_type))
    return all_components
def load_components(file_descr, graph, component_layer_map=None):
    num_components = collect_until_token_and_read(file_descr, b'<NumComponents>')
    log.debug('Network contains {} components'.format(num_components))
    is_nnet3 = (False if (component_layer_map is None) else True)
    if (not is_nnet3):
        collect_until_token(file_descr, b'<Components>')
    all_components = list()
    name = 
    for _ in range(num_components):
        if is_nnet3:
            name = collect_until_token_and_read(file_descr, b'<ComponentName>', np.string_)
        component_type = find_next_component(file_descr)
        if (component_type == end_of_nnet_tag.lower()[1:(- 1)]):
            break
        start_index = file_descr.tell()
        (end_tag, end_index) = find_end_of_component(file_descr, component_type)
        file_descr.seek(start_index)
        dim = 0
        dim_words = {b'<Dim>', b'<InputDim>'}
        for dim_word in dim_words:
            try:
                collect_until_token(file_descr, dim_word, size_search_zone=(end_index - start_index))
                cur_index = file_descr.tell()
                if (start_index < cur_index < end_index):
                    dim = read_binary_integer32_token(file_descr)
                    break
                else:
                    file_descr.seek(start_index)
            except Error:
                file_descr.seek(start_index)
        if is_nnet3:
            if (name in component_layer_map):
                layer_id = component_layer_map[name][0]
                for layer in component_layer_map[name]:
                    node = Node(graph, layer)
                    node['parameters'] = get_parameters(file_descr, start_index, end_index)
                    node['op'] = component_type
                    for (o_n_name, params) in node.get_outputs():
                        o_n = Node(graph, o_n_name)
                        if ((o_n['op'] == 'MemoryOffset') and (dim != 0)):
                            o_n['parameters']['element_size'] = int64_array([1, dim])
            else:
                raise Error('Something wrong with layer {}'.format(name))
        else:
            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')
        if hasattr(graph, 'op_names_statistic'):
            graph.op_names_statistic[component_type] += 1
        all_components.append(layer_id)
        log.debug('{} (type is {}) was loaded'.format(layer_id, component_type))
    return all_components