nncf/torch/pruning/utils.py
def _calculate_output_shape(graph: NNCFGraph, node: NNCFNode) -> Tuple[int, ...]:
    """
    Calculates output shape of convolution layer by input edge.

    :param graph: the model graph
    :param node: node from NNCF graph
    :return: output shape
    """
    in_edge = graph.get_input_edges(node)[0]
    shape = list(in_edge.tensor_shape)[2:]
    attrs = node.layer_attributes

    assert isinstance(attrs, ConvolutionLayerAttributes)

    for i, _ in enumerate(shape):
        if attrs.transpose:
            shape[i] = (shape[i] - 1) * attrs.stride[i] - 2 * attrs.padding_values[i] + attrs.kernel_size[i]
        else:
            shape[i] = (shape[i] + 2 * attrs.padding_values[i] - attrs.kernel_size[i]) // attrs.stride[i] + 1
    return tuple(shape)

    Calculates output shape of convolution layer by input edge.

    :param graph: the model graph
    :param node: node from NNCF graph
    :return: output shape
    
Calculates output shape of convolution layer by input edge.
Calculates output shape of convolution layer by input edge .
def _calculate_output_shape(graph: NNCFGraph, node: NNCFNode) -> Tuple[int, ...]:
    in_edge = graph.get_input_edges(node)[0]
    shape = list(in_edge.tensor_shape)[2:]
    attrs = node.layer_attributes
    assert isinstance(attrs, ConvolutionLayerAttributes)
    for i, _ in enumerate(shape):
        if attrs.transpose:
            shape[i] = (shape[i] - 1) * attrs.stride[i] - 2 * attrs.padding_values[i] + attrs.kernel_size[i]
        else:
            shape[i] = (shape[i] + 2 * attrs.padding_values[i] - attrs.kernel_size[i]) // attrs.stride[i] + 1
    return tuple(shape)
def _calculate_output_shape ( graph : NNCFGraph , node : NNCFNode ) -> Tuple [ int , ... ] : in_edge = graph . get_input_edges ( node ) [ 0 ] shape = list ( in_edge . tensor_shape ) [ 2 : ] attrs = node . layer_attributes assert isinstance ( attrs , ConvolutionLayerAttributes ) for i , _ in enumerate ( shape ) : if attrs . transpose : shape [ i ] = ( shape [ i ] - 1 ) * attrs . stride [ i ] - 2 * attrs . padding_values [ i ] + attrs . kernel_size [ i ] else : shape [ i ] = ( shape [ i ] + 2 * attrs . padding_values [ i ] - attrs . kernel_size [ i ] ) // attrs . stride [ i ] + 1 return tuple ( shape )
Calculates output shape of convolution layer by input edge.
Calculates output shape of convolution layer by input edge .
"""
    Calculates output shape of convolution layer by input edge.

    :param graph: the model graph
    :param node: node from NNCF graph
    :return: output shape
    """
None
graph
NNCFGraph
the model graph
the model graph
node
NNCFNode
node from NNCF graph
node from NNCF graph