nncf/common/pruning/utils.py
def calculate_in_out_channels_by_masks(pruning_groups: List[Cluster[PrunedLayerInfoBase]],
                                       num_of_sparse_elements_by_node: Dict[NNCFNodeName, int],
                                       full_input_channels: Dict[str, int],
                                       full_output_channels: Dict[str, int],
                                       pruning_groups_next_nodes: Dict[int, List[str]]) -> Tuple[Dict[str, int],
                                                                                                 Dict[str, int]]:
    """
    Imitates filters pruning by removing output filters zeroed by pruning masks in each pruning group
    and updating corresponding input channels number in `pruning_groups_next_nodes` nodes.

    :param pruning_groups: A list of pruning groups.
    :param num_of_sparse_elements_by_node: A dictionary of num_of_sparse_elements of each pruning node.
    :param full_input_channels:  A dictionary of input channels number in original model.
    :param full_output_channels: A dictionary of output channels number in original model.
    :param pruning_groups_next_nodes: A dictionary of next nodes of each pruning group.
    :return Dictionary of new input channels number {node_name: channels_num}
    """

    def get_num_of_sparse_elements_by_node(node_name: str) -> int:
        return num_of_sparse_elements_by_node[node_name]

    return _calculate_in_out_channels(pruning_groups,
                                      get_num_of_sparse_elements_by_node,
                                      full_input_channels,
                                      full_output_channels,
                                      pruning_groups_next_nodes)

    Imitates filters pruning by removing output filters zeroed by pruning masks in each pruning group
    and updating corresponding input channels number in `pruning_groups_next_nodes` nodes.

    :param pruning_groups: A list of pruning groups.
    :param num_of_sparse_elements_by_node: A dictionary of num_of_sparse_elements of each pruning node.
    :param full_input_channels:  A dictionary of input channels number in original model.
    :param full_output_channels: A dictionary of output channels number in original model.
    :param pruning_groups_next_nodes: A dictionary of next nodes of each pruning group.
    :return Dictionary of new input channels number {node_name: channels_num}
    
Imitates filters pruning by removing output filters zeroed by pruning masks in each pruning group
and updating corresponding input channels number in `pruning_groups_next_nodes` nodes.

:param pruning_groups: A list of pruning groups.
:param num_of_sparse_elements_by_node: A dictionary of num_of_sparse_elements of each pruning node.
:param full_input_channels:  A dictionary of input channels number in original model.
:param full_output_channels: A dictionary of output channels number in original model.
:param pruning_groups_next_nodes: A dictionary of next nodes of each pruning group.
:return Dictionary of new input channels number {node_name: channels_num}
Imitates filters pruning by removing output filters zeroed by pruning masks in each pruning group and updating corresponding input channels number in ` pruning_groups_next_nodes ` nodes . : param pruning_groups : A list of pruning groups . : param num_of_sparse_elements_by_node : A dictionary of num_of_sparse_elements of each pruning node . : param full_input_channels : A dictionary of input channels number in original model . : param full_output_channels : A dictionary of output channels number in original model . : param pruning_groups_next_nodes : A dictionary of next nodes of each pruning group . : return Dictionary of new input channels number { node_name : channels_num }
def calculate_in_out_channels_by_masks(pruning_groups: List[Cluster[PrunedLayerInfoBase]],
                                       num_of_sparse_elements_by_node: Dict[NNCFNodeName, int],
                                       full_input_channels: Dict[str, int],
                                       full_output_channels: Dict[str, int],
                                       pruning_groups_next_nodes: Dict[int, List[str]]) -> Tuple[Dict[str, int],
                                                                                                 Dict[str, int]]:
    def get_num_of_sparse_elements_by_node(node_name: str) -> int:
        return num_of_sparse_elements_by_node[node_name]
    return _calculate_in_out_channels(pruning_groups,
                                      get_num_of_sparse_elements_by_node,
                                      full_input_channels,
                                      full_output_channels,
                                      pruning_groups_next_nodes)
def calculate_in_out_channels_by_masks ( pruning_groups : List [ Cluster [ PrunedLayerInfoBase ] ] , num_of_sparse_elements_by_node : Dict [ NNCFNodeName , int ] , full_input_channels : Dict [ str , int ] , full_output_channels : Dict [ str , int ] , pruning_groups_next_nodes : Dict [ int , List [ str ] ] ) -> Tuple [ Dict [ str , int ] , Dict [ str , int ] ] : def get_num_of_sparse_elements_by_node ( node_name : str ) -> int : return num_of_sparse_elements_by_node [ node_name ] return _calculate_in_out_channels ( pruning_groups , get_num_of_sparse_elements_by_node , full_input_channels , full_output_channels , pruning_groups_next_nodes )
Imitates filters pruning by removing output filters zeroed by pruning masks in each pruning group
and updating corresponding input channels number in `pruning_groups_next_nodes` nodes.
Imitates filters pruning by removing output filters zeroed by pruning masks in each pruning group and updating corresponding input channels number in ` pruning_groups_next_nodes ` nodes .
"""
    Imitates filters pruning by removing output filters zeroed by pruning masks in each pruning group
    and updating corresponding input channels number in `pruning_groups_next_nodes` nodes.

    :param pruning_groups: A list of pruning groups.
    :param num_of_sparse_elements_by_node: A dictionary of num_of_sparse_elements of each pruning node.
    :param full_input_channels:  A dictionary of input channels number in original model.
    :param full_output_channels: A dictionary of output channels number in original model.
    :param pruning_groups_next_nodes: A dictionary of next nodes of each pruning group.
    :return Dictionary of new input channels number {node_name: channels_num}
    """
pruning_groups
List[Cluster[PrunedLayerInfoBase]]
num_of_sparse_elements_by_node
Dict[NNCFNodeName, int]
full_input_channels
Dict[str, int]
full_output_channels
Dict[str, int]
pruning_groups_next_nodes
Dict[int, List[str]]