nncf/common/pruning/node_selector.py
def _filter_groups(self, pruned_nodes_clusterization: Clusterization,
                       can_prune: Dict[int, PruningAnalysisDecision]) -> None:
        """
        Check whether all nodes in group can be pruned based on user-defined constraints and
        connections inside the network. Otherwise the whole group cannot be pruned and will be
        removed the clusterization.

        :param pruned_nodes_clusterization: Clusterization with pruning nodes groups.
        :param can_prune: Can this node be pruned or not.
        """
        for cluster in pruned_nodes_clusterization.get_all_clusters():
            nodes_decisions = [can_prune[node.node_id] for node in cluster.elements]
            nodes_names = [node.node_name for node in cluster.elements]
            if not all(nodes_decisions):
                cannot_prune_messages = []
                for name, decision in zip(nodes_names, nodes_decisions):
                    if not decision:
                        message = PruningAnalysisReason.message(name, decision)
                        if message:
                            cannot_prune_messages.append(message)

                nncf_logger.info('Group of nodes [{}] can\'t be pruned, because some nodes should\'t be pruned, '
                                 'error messages for this nodes: {}.'.format(
                                    ', '.join(nodes_names),
                                    ', '.join(cannot_prune_messages)))
                pruned_nodes_clusterization.delete_cluster(cluster.id)
            else:
                nncf_logger.info('Group of nodes [{}] will be pruned together.'.format(", ".join(nodes_names)))

        Check whether all nodes in group can be pruned based on user-defined constraints and
        connections inside the network. Otherwise the whole group cannot be pruned and will be
        removed the clusterization.

        :param pruned_nodes_clusterization: Clusterization with pruning nodes groups.
        :param can_prune: Can this node be pruned or not.
        
Check whether all nodes in group can be pruned based on user-defined constraints and
connections inside the network. Otherwise the whole group cannot be pruned and will be
removed the clusterization.
Check whether all nodes in group can be pruned based on user - defined constraints and connections inside the network . Otherwise the whole group cannot be pruned and will be removed the clusterization .
def _filter_groups(self, pruned_nodes_clusterization: Clusterization,
                       can_prune: Dict[int, PruningAnalysisDecision]) -> None:
        for cluster in pruned_nodes_clusterization.get_all_clusters():
            nodes_decisions = [can_prune[node.node_id] for node in cluster.elements]
            nodes_names = [node.node_name for node in cluster.elements]
            if not all(nodes_decisions):
                cannot_prune_messages = []
                for name, decision in zip(nodes_names, nodes_decisions):
                    if not decision:
                        message = PruningAnalysisReason.message(name, decision)
                        if message:
                            cannot_prune_messages.append(message)
                nncf_logger.info('Group of nodes [{}] can\'t be pruned, because some nodes should\'t be pruned, '
                                 'error messages for this nodes: {}.'.format(
                                    ', '.join(nodes_names),
                                    ', '.join(cannot_prune_messages)))
                pruned_nodes_clusterization.delete_cluster(cluster.id)
            else:
                nncf_logger.info('Group of nodes [{}] will be pruned together.'.format(", ".join(nodes_names)))
def _filter_groups ( self , pruned_nodes_clusterization : Clusterization , can_prune : Dict [ int , PruningAnalysisDecision ] ) -> None : for cluster in pruned_nodes_clusterization . get_all_clusters ( ) : nodes_decisions = [ can_prune [ node . node_id ] for node in cluster . elements ] nodes_names = [ node . node_name for node in cluster . elements ] if not all ( nodes_decisions ) : cannot_prune_messages = [ ] for name , decision in zip ( nodes_names , nodes_decisions ) : if not decision : message = PruningAnalysisReason . message ( name , decision ) if message : cannot_prune_messages . append ( message ) nncf_logger . info ( 'Group of nodes [{}] can\'t be pruned, because some nodes should\'t be pruned, ' 'error messages for this nodes: {}.' . format ( ', ' . join ( nodes_names ) , ', ' . join ( cannot_prune_messages ) ) ) pruned_nodes_clusterization . delete_cluster ( cluster . id ) else : nncf_logger . info ( 'Group of nodes [{}] will be pruned together.' . format ( ", " . join ( nodes_names ) ) )
Check whether all nodes in group can be pruned based on user-defined constraints and
connections inside the network.
Check whether all nodes in group can be pruned based on user - defined constraints and connections inside the network .
"""
        Check whether all nodes in group can be pruned based on user-defined constraints and
        connections inside the network. Otherwise the whole group cannot be pruned and will be
        removed the clusterization.

        :param pruned_nodes_clusterization: Clusterization with pruning nodes groups.
        :param can_prune: Can this node be pruned or not.
        """
self
pruned_nodes_clusterization
Clusterization
Clusterization with pruning nodes groups.
Clusterization with pruning nodes groups .
can_prune
Dict[int, PruningAnalysisDecision]
Can this node be pruned or not.
Can this node be pruned or not .