nncf/torch/pruning/utils.py
def collect_output_shapes(graph: NNCFGraph) -> Dict[NNCFNodeName, List[int]]:
    """
    Collects output dimension shapes for convolutions and fully connected layers
    from the connected edges in the NNCFGraph.

    :param graph: NNCFGraph.
    :return: Dictionary of output dimension shapes. E.g {node_name: (height, width)}
    """
    modules_out_shapes = {}
    for node in graph.get_nodes_by_types([v.op_func_name for v in NNCF_GENERAL_CONV_MODULES_DICT]):
        output_edges = graph.get_output_edges(node)
        if output_edges:
            out_edge = output_edges[0]
            out_shape = out_edge.tensor_shape[2:]
        else:
            # For disconnected NNCFGraph when node have no output edge
            out_shape = _calculate_output_shape(graph, node)
            nncf_logger.error("Node %s have no output edge in NNCFGraph", node.node_name)
        modules_out_shapes[node.node_name] = out_shape

    for node in graph.get_nodes_by_types([v.op_func_name for v in NNCF_LINEAR_MODULES_DICT]):
        output_edges = graph.get_output_edges(node)
        if output_edges:
            out_edge = graph.get_output_edges(node)[0]
            out_shape = out_edge.tensor_shape
            modules_out_shapes[node.node_name] = out_shape[-1]
        else:
            # For disconnected NNCFGraph when node have no output edge
            nncf_logger.error("Node %s have no output edge in NNCFGraph", node.node_name)
            modules_out_shapes[node.node_name] = node.layer_attributes.out_features
    return modules_out_shapes

    Collects output dimension shapes for convolutions and fully connected layers
    from the connected edges in the NNCFGraph.

    :param graph: NNCFGraph.
    :return: Dictionary of output dimension shapes. E.g {node_name: (height, width)}
    
Collects output dimension shapes for convolutions and fully connected layers
from the connected edges in the NNCFGraph.
Collects output dimension shapes for convolutions and fully connected layers from the connected edges in the NNCFGraph .
def collect_output_shapes(graph: NNCFGraph) -> Dict[NNCFNodeName, List[int]]:
    modules_out_shapes = {}
    for node in graph.get_nodes_by_types([v.op_func_name for v in NNCF_GENERAL_CONV_MODULES_DICT]):
        output_edges = graph.get_output_edges(node)
        if output_edges:
            out_edge = output_edges[0]
            out_shape = out_edge.tensor_shape[2:]
        else:
            out_shape = _calculate_output_shape(graph, node)
            nncf_logger.error("Node %s have no output edge in NNCFGraph", node.node_name)
        modules_out_shapes[node.node_name] = out_shape
    for node in graph.get_nodes_by_types([v.op_func_name for v in NNCF_LINEAR_MODULES_DICT]):
        output_edges = graph.get_output_edges(node)
        if output_edges:
            out_edge = graph.get_output_edges(node)[0]
            out_shape = out_edge.tensor_shape
            modules_out_shapes[node.node_name] = out_shape[-1]
        else:
            nncf_logger.error("Node %s have no output edge in NNCFGraph", node.node_name)
            modules_out_shapes[node.node_name] = node.layer_attributes.out_features
    return modules_out_shapes
def collect_output_shapes ( graph : NNCFGraph ) -> Dict [ NNCFNodeName , List [ int ] ] : modules_out_shapes = { } for node in graph . get_nodes_by_types ( [ v . op_func_name for v in NNCF_GENERAL_CONV_MODULES_DICT ] ) : output_edges = graph . get_output_edges ( node ) if output_edges : out_edge = output_edges [ 0 ] out_shape = out_edge . tensor_shape [ 2 : ] else : out_shape = _calculate_output_shape ( graph , node ) nncf_logger . error ( "Node %s have no output edge in NNCFGraph" , node . node_name ) modules_out_shapes [ node . node_name ] = out_shape for node in graph . get_nodes_by_types ( [ v . op_func_name for v in NNCF_LINEAR_MODULES_DICT ] ) : output_edges = graph . get_output_edges ( node ) if output_edges : out_edge = graph . get_output_edges ( node ) [ 0 ] out_shape = out_edge . tensor_shape modules_out_shapes [ node . node_name ] = out_shape [ - 1 ] else : nncf_logger . error ( "Node %s have no output edge in NNCFGraph" , node . node_name ) modules_out_shapes [ node . node_name ] = node . layer_attributes . out_features return modules_out_shapes
Collects output dimension shapes for convolutions and fully connected layers
from the connected edges in the NNCFGraph.
Collects output dimension shapes for convolutions and fully connected layers from the connected edges in the NNCFGraph .
"""
    Collects output dimension shapes for convolutions and fully connected layers
    from the connected edges in the NNCFGraph.

    :param graph: NNCFGraph.
    :return: Dictionary of output dimension shapes. E.g {node_name: (height, width)}
    """ # For disconnected NNCFGraph when node have no output edge # For disconnected NNCFGraph when node have no output edge
Dictionary of output dimension shapes. E.g {node_name: (height, width)}
Dictionary of output dimension shapes . E . g { node_name : ( height width ) }
graph
NNCFGraph
None