TrainingExtensions/tensorflow/src/python/aimet_tensorflow/keras/batch_norm_fold.py
def _get_ordered_layers(node_layer_map: Dict,
                        layer_out_node_map: Dict) -> List[tf.keras.layers.Layer]:
    """
    Function to return the list with all the layers in which layers come before parent layer.

    :param node_layer_map: dictionary includes node_ref as a key, in_layers and out_layer as value
    :param layer_out_node_map: dictionary includes layer_ref as a key, outbound nodes as value
    :return: ordered_layers: List of all layers in the order of occurrence
    """
    # to find the input layers of the model
    input_layers = common.find_input_layers(node_layer_map)

    #  Set of all layers that have been visited (to cut short duplicate traversals)
    visited_layers = set()

    # List of all layers in the opposite of order of occurrence
    reversed_ordered_layers = []

    for input_layer in input_layers:
        _add_children_layer_before_parent_layer(input_layer, node_layer_map, layer_out_node_map,
                                                visited_layers, reversed_ordered_layers)

    # reverse the list because layers are in reverse order
    ordered_layers = reversed_ordered_layers[::-1]

    # # filter ordered ops for only valid ops
    # ordered_ops = [op for op in ordered_ops if op in valid_ops]

    return ordered_layers

    Function to return the list with all the layers in which layers come before parent layer.

    :param node_layer_map: dictionary includes node_ref as a key, in_layers and out_layer as value
    :param layer_out_node_map: dictionary includes layer_ref as a key, outbound nodes as value
    :return: ordered_layers: List of all layers in the order of occurrence
    
Function to return the list with all the layers in which layers come before parent layer.
Function to return the list with all the layers in which layers come before parent layer .
def _get_ordered_layers(node_layer_map: Dict,
                        layer_out_node_map: Dict) -> List[tf.keras.layers.Layer]:
    input_layers = common.find_input_layers(node_layer_map)
    visited_layers = set()
    reversed_ordered_layers = []
    for input_layer in input_layers:
        _add_children_layer_before_parent_layer(input_layer, node_layer_map, layer_out_node_map,
                                                visited_layers, reversed_ordered_layers)
    ordered_layers = reversed_ordered_layers[::-1]
    return ordered_layers
def _get_ordered_layers ( node_layer_map : Dict , layer_out_node_map : Dict ) -> List [ tf . keras . layers . Layer ] : input_layers = common . find_input_layers ( node_layer_map ) visited_layers = set ( ) reversed_ordered_layers = [ ] for input_layer in input_layers : _add_children_layer_before_parent_layer ( input_layer , node_layer_map , layer_out_node_map , visited_layers , reversed_ordered_layers ) ordered_layers = reversed_ordered_layers [ : : - 1 ] return ordered_layers
Function to return the list with all the layers in which layers come before parent layer.
Function to return the list with all the layers in which layers come before parent layer .
"""
    Function to return the list with all the layers in which layers come before parent layer.

    :param node_layer_map: dictionary includes node_ref as a key, in_layers and out_layer as value
    :param layer_out_node_map: dictionary includes layer_ref as a key, outbound nodes as value
    :return: ordered_layers: List of all layers in the order of occurrence
    """ # to find the input layers of the model #  Set of all layers that have been visited (to cut short duplicate traversals) # List of all layers in the opposite of order of occurrence # reverse the list because layers are in reverse order # # filter ordered ops for only valid ops # ordered_ops = [op for op in ordered_ops if op in valid_ops]
List of all layers in the order of occurrence
List of all layers in the order of occurrence
node_layer_map
Dict
dictionary includes node_ref as a key, in_layers and out_layer as value
dictionary includes node_ref as a key in_layers and out_layer as value
layer_out_node_map
Dict
dictionary includes layer_ref as a key, outbound nodes as value
dictionary includes layer_ref as a key outbound nodes as value