TrainingExtensions/tensorflow/src/python/aimet_tensorflow/quantsim.py
def _insert_param_quantizer_recurrent(self, inner_ops, preceeding_tensor, quant_op_name: str,
                                          op_mode: libpymo.QuantizationMode,
                                          quantizer_dict: Dict[str, QuantizerInfo], quantizer_type: QuantizerType,
                                          bit_width: int = 8):
        """
        Create and insert a post-training quant op after a given tensor
        :param preceeding_tensor: Preceeding tensor to insert the quant op after
        :param quant_op_name: Name to give to the new quant op
        :param op_mode: Starting mode to configure for the new quant op
        :param quantizer_dict: dictionary of op and QuantizerInfo
        :param quantizer_type : indicate param or activation quantizer
        :param bit_width : bit-width to be used (output or param quantization bit-width), default set to 8.
        :return: None
        """
        # pylint: disable=too-many-locals
        # Create variables for op_mode, tensor_quantizer_reference, encoding_min, encoding_max, bitwidth and
        # is_symmetric_encoding flag
        # (so we can change these in the future, if needed)

        op_mode_var, tensor_quant_ref, encoding_min, encoding_max, bit_width, use_symmetric_encoding = \
            self._create_and_init_quant_op_input_vars(quant_op_name, quantizer_dict, quantizer_type, op_mode,
                                                      bit_width)

        # extract loop cond bool variable
        time_step_tensor = get_time_steps_tensor_from_rnn_inner_ops(inner_ops)

        # CPU device assignment for QcQuantize op
        q_op_out = self._create_and_place_recurrent_param_quantize_op(quant_op_name, preceeding_tensor,
                                                                      op_mode_var,
                                                                      tensor_quant_ref,
                                                                      encoding_min,
                                                                      encoding_max,
                                                                      bit_width,
                                                                      use_symmetric_encoding,
                                                                      time_step_tensor)

        return q_op_out

        Create and insert a post-training quant op after a given tensor
        :param preceeding_tensor: Preceeding tensor to insert the quant op after
        :param quant_op_name: Name to give to the new quant op
        :param op_mode: Starting mode to configure for the new quant op
        :param quantizer_dict: dictionary of op and QuantizerInfo
        :param quantizer_type : indicate param or activation quantizer
        :param bit_width : bit-width to be used (output or param quantization bit-width), default set to 8.
        :return: None
        
Create and insert a post-training quant op after a given tensor
Create and insert a post - training quant op after a given tensor
def _insert_param_quantizer_recurrent(self, inner_ops, preceeding_tensor, quant_op_name: str,
                                          op_mode: libpymo.QuantizationMode,
                                          quantizer_dict: Dict[str, QuantizerInfo], quantizer_type: QuantizerType,
                                          bit_width: int = 8):
        op_mode_var, tensor_quant_ref, encoding_min, encoding_max, bit_width, use_symmetric_encoding = \
            self._create_and_init_quant_op_input_vars(quant_op_name, quantizer_dict, quantizer_type, op_mode,
                                                      bit_width)
        time_step_tensor = get_time_steps_tensor_from_rnn_inner_ops(inner_ops)
        q_op_out = self._create_and_place_recurrent_param_quantize_op(quant_op_name, preceeding_tensor,
                                                                      op_mode_var,
                                                                      tensor_quant_ref,
                                                                      encoding_min,
                                                                      encoding_max,
                                                                      bit_width,
                                                                      use_symmetric_encoding,
                                                                      time_step_tensor)
        return q_op_out
def _insert_param_quantizer_recurrent ( self , inner_ops , preceeding_tensor , quant_op_name : str , op_mode : libpymo . QuantizationMode , quantizer_dict : Dict [ str , QuantizerInfo ] , quantizer_type : QuantizerType , bit_width : int = 8 ) : op_mode_var , tensor_quant_ref , encoding_min , encoding_max , bit_width , use_symmetric_encoding = self . _create_and_init_quant_op_input_vars ( quant_op_name , quantizer_dict , quantizer_type , op_mode , bit_width ) time_step_tensor = get_time_steps_tensor_from_rnn_inner_ops ( inner_ops ) q_op_out = self . _create_and_place_recurrent_param_quantize_op ( quant_op_name , preceeding_tensor , op_mode_var , tensor_quant_ref , encoding_min , encoding_max , bit_width , use_symmetric_encoding , time_step_tensor ) return q_op_out
Create and insert a post-training quant op after a given tensor
Create and insert a post - training quant op after a given tensor
"""
        Create and insert a post-training quant op after a given tensor
        :param preceeding_tensor: Preceeding tensor to insert the quant op after
        :param quant_op_name: Name to give to the new quant op
        :param op_mode: Starting mode to configure for the new quant op
        :param quantizer_dict: dictionary of op and QuantizerInfo
        :param quantizer_type : indicate param or activation quantizer
        :param bit_width : bit-width to be used (output or param quantization bit-width), default set to 8.
        :return: None
        """ # pylint: disable=too-many-locals # Create variables for op_mode, tensor_quantizer_reference, encoding_min, encoding_max, bitwidth and # is_symmetric_encoding flag # (so we can change these in the future, if needed) # extract loop cond bool variable # CPU device assignment for QcQuantize op
None
self
inner_ops
preceeding_tensor
Preceeding tensor to insert the quant op after
Preceeding tensor to insert the quant op after
quant_op_name
str
Name to give to the new quant op
Name to give to the new quant op
op_mode
libpymo.QuantizationMode
Starting mode to configure for the new quant op
Starting mode to configure for the new quant op
quantizer_dict
Dict[str, QuantizerInfo]
dictionary of op and QuantizerInfo
dictionary of op and QuantizerInfo
quantizer_type
QuantizerType
indicate param or activation quantizer
indicate param or activation quantizer
bit_width
int
bit-width to be used (output or param quantization bit-width), default set to 8.
bit - width to be used ( output or param quantization bit - width ) default set to 8 .