nncf/common/pruning/operations.py
def generate_output_mask(cls, node: NNCFNode, graph: NNCFGraph,
                             tensor_processor: Type[NNCFPruningBaseTensorProcessor]) -> Optional[NNCFTensor]:
        """
        Generate output mask from input masks with all None replaced by identity masks.
        If all input masks is None return None.

        :param node: Node to determine it's sources.
        :param graph: NNCF graph to work with.
        :param tensor_processor: Interface with tensor processing methods.
        :return: Filled input masks.
        """
        input_edges = graph.get_input_edges(node)
        previous_nodes = [edge.from_node for edge in input_edges]
        input_masks = [input_node.data['output_mask'] for input_node in previous_nodes]

        not_empty_masks = [mask for mask in input_masks if mask is not None]  # type: List[NNCFTensor]
        if not not_empty_masks:
            return None

        first_non_empty_mask = not_empty_masks[0]
        device = first_non_empty_mask.device
        filled_input_masks = []
        for i, mask in enumerate(input_masks):
            if mask is None:
                concat_axis = node.layer_attributes.axis
                concat_dim = input_edges[i].tensor_shape[concat_axis]
                mask = tensor_processor.ones(concat_dim, device)
            filled_input_masks.append(mask)
        result_mask = tensor_processor.concatenate(filled_input_masks, 0)
        return result_mask

        Generate output mask from input masks with all None replaced by identity masks.
        If all input masks is None return None.

        :param node: Node to determine it's sources.
        :param graph: NNCF graph to work with.
        :param tensor_processor: Interface with tensor processing methods.
        :return: Filled input masks.
        
Generate output mask from input masks with all None replaced by identity masks.
If all input masks is None return None.
Generate output mask from input masks with all None replaced by identity masks . If all input masks is None return None .
def generate_output_mask(cls, node: NNCFNode, graph: NNCFGraph,
                             tensor_processor: Type[NNCFPruningBaseTensorProcessor]) -> Optional[NNCFTensor]:
        input_edges = graph.get_input_edges(node)
        previous_nodes = [edge.from_node for edge in input_edges]
        input_masks = [input_node.data['output_mask'] for input_node in previous_nodes]
        not_empty_masks = [mask for mask in input_masks if mask is not None]  
        if not not_empty_masks:
            return None
        first_non_empty_mask = not_empty_masks[0]
        device = first_non_empty_mask.device
        filled_input_masks = []
        for i, mask in enumerate(input_masks):
            if mask is None:
                concat_axis = node.layer_attributes.axis
                concat_dim = input_edges[i].tensor_shape[concat_axis]
                mask = tensor_processor.ones(concat_dim, device)
            filled_input_masks.append(mask)
        result_mask = tensor_processor.concatenate(filled_input_masks, 0)
        return result_mask
def generate_output_mask ( cls , node : NNCFNode , graph : NNCFGraph , tensor_processor : Type [ NNCFPruningBaseTensorProcessor ] ) -> Optional [ NNCFTensor ] : input_edges = graph . get_input_edges ( node ) previous_nodes = [ edge . from_node for edge in input_edges ] input_masks = [ input_node . data [ 'output_mask' ] for input_node in previous_nodes ] not_empty_masks = [ mask for mask in input_masks if mask is not None ] if not not_empty_masks : return None first_non_empty_mask = not_empty_masks [ 0 ] device = first_non_empty_mask . device filled_input_masks = [ ] for i , mask in enumerate ( input_masks ) : if mask is None : concat_axis = node . layer_attributes . axis concat_dim = input_edges [ i ] . tensor_shape [ concat_axis ] mask = tensor_processor . ones ( concat_dim , device ) filled_input_masks . append ( mask ) result_mask = tensor_processor . concatenate ( filled_input_masks , 0 ) return result_mask
Generate output mask from input masks with all None replaced by identity masks.
Generate output mask from input masks with all None replaced by identity masks .
"""
        Generate output mask from input masks with all None replaced by identity masks.
        If all input masks is None return None.

        :param node: Node to determine it's sources.
        :param graph: NNCF graph to work with.
        :param tensor_processor: Interface with tensor processing methods.
        :return: Filled input masks.
        """ # type: List[NNCFTensor]
Filled input masks.
Filled input masks .
cls
node
NNCFNode
Node to determine it's sources.
Node to determine it ' s sources .
graph
NNCFGraph
NNCF graph to work with.
NNCF graph to work with .
tensor_processor
Type[NNCFPruningBaseTensorProcessor]
Interface with tensor processing methods.
Interface with tensor processing methods .