nncf/torch/quantization/layers.py
def apply_minmax_init(self,
                          min_values: torch.Tensor,
                          max_values: torch.Tensor,
                          log_module_name: str = None):
        """min_values and max_values must have the same shape as specified in self.scale_shape"""
        if self.initialized:
            nncf_logger.debug("Skipped initializing {} - loaded from checkpoint".format(log_module_name))
            return

        if torch.all(torch.isinf(min_values)) or torch.all(torch.isinf(max_values)):
            raise ValueError('Statistics are not collected for {}'.format(log_module_name))

        if torch.any(torch.eq(min_values, np.inf)) or torch.any(torch.eq(max_values, -np.inf)):
            raise ValueError('Some of the values in statistics have infinite value for {}'.format(log_module_name))

        own_device = get_model_device(self)
        min_values = min_values.to(own_device)
        max_values = max_values.to(own_device)
        self._apply_minmax_init(min_values, max_values, log_module_name)
min_values and max_values must have the same shape as specified in self.scale_shape
min_values and max_values must have the same shape as specified in self.scale_shape
min_values and max_values must have the same shape as specified in self . scale_shape
def apply_minmax_init(self,
                          min_values: torch.Tensor,
                          max_values: torch.Tensor,
                          log_module_name: str = None):
        if self.initialized:
            nncf_logger.debug("Skipped initializing {} - loaded from checkpoint".format(log_module_name))
            return
        if torch.all(torch.isinf(min_values)) or torch.all(torch.isinf(max_values)):
            raise ValueError('Statistics are not collected for {}'.format(log_module_name))
        if torch.any(torch.eq(min_values, np.inf)) or torch.any(torch.eq(max_values, -np.inf)):
            raise ValueError('Some of the values in statistics have infinite value for {}'.format(log_module_name))
        own_device = get_model_device(self)
        min_values = min_values.to(own_device)
        max_values = max_values.to(own_device)
        self._apply_minmax_init(min_values, max_values, log_module_name)
def apply_minmax_init ( self , min_values : torch . Tensor , max_values : torch . Tensor , log_module_name : str = None ) : if self . initialized : nncf_logger . debug ( "Skipped initializing {} - loaded from checkpoint" . format ( log_module_name ) ) return if torch . all ( torch . isinf ( min_values ) ) or torch . all ( torch . isinf ( max_values ) ) : raise ValueError ( 'Statistics are not collected for {}' . format ( log_module_name ) ) if torch . any ( torch . eq ( min_values , np . inf ) ) or torch . any ( torch . eq ( max_values , - np . inf ) ) : raise ValueError ( 'Some of the values in statistics have infinite value for {}' . format ( log_module_name ) ) own_device = get_model_device ( self ) min_values = min_values . to ( own_device ) max_values = max_values . to ( own_device ) self . _apply_minmax_init ( min_values , max_values , log_module_name )
min_values and max_values must have the same shape as specified in self.scale_shape
min_values and max_values must have the same shape as specified in self . scale_shape
"""min_values and max_values must have the same shape as specified in self.scale_shape"""
self
min_values
torch.Tensor
max_values
torch.Tensor
log_module_name
str