TrainingExtensions/tensorflow/src/python/aimet_tensorflow/quantsim.py
def _insert_param_quantizer_loop_context(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 in a loop control flow context.
        :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
        """

        # this handles cases such as conditional blocks that are defined in their own context
        context_bk = updated_graph_flow_context_to_loop_context(self.session.graph, preceeding_tensor)
        q_op_out = self._insert_param_quantizer_recurrent(inner_ops, preceeding_tensor, quant_op_name, op_mode, quantizer_dict,
                                                          quantizer_type, bit_width)

        # revert the context back to graph level from op context
        set_graph_flow_context(self.session.graph, context_bk)

        return q_op_out

        Create and insert a post-training quant op after a given tensor in a loop control flow context.
        :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 in a loop control flow context.
Create and insert a post - training quant op after a given tensor in a loop control flow context .
def _insert_param_quantizer_loop_context(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):
        context_bk = updated_graph_flow_context_to_loop_context(self.session.graph, preceeding_tensor)
        q_op_out = self._insert_param_quantizer_recurrent(inner_ops, preceeding_tensor, quant_op_name, op_mode, quantizer_dict,
                                                          quantizer_type, bit_width)
        set_graph_flow_context(self.session.graph, context_bk)
        return q_op_out
def _insert_param_quantizer_loop_context ( 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 ) : context_bk = updated_graph_flow_context_to_loop_context ( self . session . graph , preceeding_tensor ) q_op_out = self . _insert_param_quantizer_recurrent ( inner_ops , preceeding_tensor , quant_op_name , op_mode , quantizer_dict , quantizer_type , bit_width ) set_graph_flow_context ( self . session . graph , context_bk ) return q_op_out
Create and insert a post-training quant op after a given tensor in a loop control flow context.
Create and insert a post - training quant op after a given tensor in a loop control flow context .
"""
        Create and insert a post-training quant op after a given tensor in a loop control flow context.
        :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
        """ # this handles cases such as conditional blocks that are defined in their own context # revert the context back to graph level from op context
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 .