nncf/torch/pruning/filter_pruning/algo.py
def _find_uniform_pruning_level_for_target_flops(self, target_flops_pruning_level: float) -> float:
        """
        Searching for the minimal uniform layer-wise weight pruning level (proportion of zero filters in a layer)
         needed to achieve the target pruning level in flops.

        :param target_flops_pruning_level: target proportion of flops that should be pruned in the model
        :return: uniform pruning level for all layers
        """
        error = 0.01
        target_flops = self.full_flops * (1 - target_flops_pruning_level)
        left, right = 0.0, 1.0
        while abs(right - left) > error:
            middle = (left + right) / 2
            flops, params_num = self._calculate_flops_and_weights_in_uniformly_pruned_model(middle)
            if flops < target_flops:
                right = middle
            else:
                left = middle
        flops, params_num = self._calculate_flops_and_weights_in_uniformly_pruned_model(right)
        if flops < target_flops:
            self.current_flops = flops
            self.current_params_num = params_num
            return right
        raise RuntimeError("Can't prune the model to get the required "
                           "pruning level in flops = {}".format(target_flops_pruning_level))

        Searching for the minimal uniform layer-wise weight pruning level (proportion of zero filters in a layer)
         needed to achieve the target pruning level in flops.

        :param target_flops_pruning_level: target proportion of flops that should be pruned in the model
        :return: uniform pruning level for all layers
        
Searching for the minimal uniform layer-wise weight pruning level (proportion of zero filters in a layer)
needed to achieve the target pruning level in flops.
Searching for the minimal uniform layer - wise weight pruning level ( proportion of zero filters in a layer ) needed to achieve the target pruning level in flops .
def _find_uniform_pruning_level_for_target_flops(self, target_flops_pruning_level: float) -> float:
        error = 0.01
        target_flops = self.full_flops * (1 - target_flops_pruning_level)
        left, right = 0.0, 1.0
        while abs(right - left) > error:
            middle = (left + right) / 2
            flops, params_num = self._calculate_flops_and_weights_in_uniformly_pruned_model(middle)
            if flops < target_flops:
                right = middle
            else:
                left = middle
        flops, params_num = self._calculate_flops_and_weights_in_uniformly_pruned_model(right)
        if flops < target_flops:
            self.current_flops = flops
            self.current_params_num = params_num
            return right
        raise RuntimeError("Can't prune the model to get the required "
                           "pruning level in flops = {}".format(target_flops_pruning_level))
def _find_uniform_pruning_level_for_target_flops ( self , target_flops_pruning_level : float ) -> float : error = 0.01 target_flops = self . full_flops * ( 1 - target_flops_pruning_level ) left , right = 0.0 , 1.0 while abs ( right - left ) > error : middle = ( left + right ) / 2 flops , params_num = self . _calculate_flops_and_weights_in_uniformly_pruned_model ( middle ) if flops < target_flops : right = middle else : left = middle flops , params_num = self . _calculate_flops_and_weights_in_uniformly_pruned_model ( right ) if flops < target_flops : self . current_flops = flops self . current_params_num = params_num return right raise RuntimeError ( "Can't prune the model to get the required " "pruning level in flops = {}" . format ( target_flops_pruning_level ) )
Searching for the minimal uniform layer-wise weight pruning level (proportion of zero filters in a layer)
needed to achieve the target pruning level in flops.
Searching for the minimal uniform layer - wise weight pruning level ( proportion of zero filters in a layer ) needed to achieve the target pruning level in flops .
"""
        Searching for the minimal uniform layer-wise weight pruning level (proportion of zero filters in a layer)
         needed to achieve the target pruning level in flops.

        :param target_flops_pruning_level: target proportion of flops that should be pruned in the model
        :return: uniform pruning level for all layers
        """
uniform pruning level for all layers
uniform pruning level for all layers
self
target_flops_pruning_level
float
target proportion of flops that should be pruned in the model
target proportion of flops that should be pruned in the model