parameters: (
        self,
        context,
        producer,
        consumers,
        name,
        moving_avg=True,
        init_min=-6.0,
        init_max=6.0,
        delay_requested=True,
        bits=8,
        narrow_range=False,)
docstring: Inserts a quant op between a producer op and (multiple) consumer ops.
  
      Args:
        context: Context where producer and consumer operations are nested.
        producer: Producer operation of the pairs where quantization will be
          inserted.
        consumers: Consumer operations of the pairs.
        name: Name for the new quantization op within the context.
        moving_avg: Specifies whether to use exponential moving average or just
          the last value seen.
        init_min: Starting minimum value for the new quantization op.
        init_max: Starting maximum value for the new quantization op.
        delay_requested: If true, implement quantization delay where needed.
          False value explicitly disables delay quantization everywhere.
        bits: Number of bits to use for quantization, must be between 2 and 8.
        narrow_range: Whether to use the narrow quantization range
          [1; 2^bits - 1] or wide range [0; 2^bits - 1].
      Raises:
        ValueError: When producer operation is not directly connected to the
          consumer operation.
docstring_summary: Inserts a quant op between a producer op and (multiple) consumer ops.
docstring_tokens: Inserts a quant op between a producer op and ( multiple ) consumer ops .
function: def _InsertQuantOp(
        self,
        context,
        producer,
        consumers,
        name,
        moving_avg=True,
        init_min=-6.0,
        init_max=6.0,
        delay_requested=True,
        bits=8,
        narrow_range=False,):
      """Inserts a quant op between a producer op and (multiple) consumer ops.
  
      Args:
        context: Context where producer and consumer operations are nested.
        producer: Producer operation of the pairs where quantization will be
          inserted.
        consumers: Consumer operations of the pairs.
        name: Name for the new quantization op within the context.
        moving_avg: Specifies whether to use exponential moving average or just
          the last value seen.
        init_min: Starting minimum value for the new quantization op.
        init_max: Starting maximum value for the new quantization op.
        delay_requested: If true, implement quantization delay where needed.
          False value explicitly disables delay quantization everywhere.
        bits: Number of bits to use for quantization, must be between 2 and 8.
        narrow_range: Whether to use the narrow quantization range
          [1; 2^bits - 1] or wide range [0; 2^bits - 1].
      Raises:
        ValueError: When producer operation is not directly connected to the
          consumer operation.
      """
      scope = context + '/' + name
      inputs = producer.outputs[0]
      if moving_avg:
        quant = (quant_ops.MovingAvgQuantize(
            inputs,
            init_min=init_min,
            init_max=init_max,
            ema_decay=self.ema_decay,
            is_training=self.is_training,
            num_bits=bits,
            narrow_range=narrow_range,
            updates_collection=_UPDATE_QUANT_OPS,
            vars_collection=self.vars_collection,
            scope=scope))
      else:
        quant = (quant_ops.LastValueQuantize(
            inputs,
            init_min=init_min,
            init_max=init_max,
            is_training=self.is_training,
            num_bits=bits,
            narrow_range=narrow_range,
            updates_collection=_UPDATE_QUANT_OPS,
            vars_collection=self.vars_collection,
            scope=scope))
  
      if delay_requested and self.quant_delay and self.quant_delay > 0:
        activate_quant = math_ops.greater_equal(
            training_util.get_global_step(),
            self.quant_delay,
            name=scope + '/activate_quant')
        quant = control_flow_ops.cond(
            activate_quant,
            lambda: quant,
            lambda: inputs,
            name=scope + '/delayed_quant')
  
      nodes_modified_count = graph_editor.reroute_ts(
          [quant], [inputs], can_modify=consumers)
      if nodes_modified_count != len(consumers):
        raise ValueError('Some inputs not quantized for ops: [%s]' %
                         ', '.join([consumer.name for consumer in consumers]))
function_tokens: def _InsertQuantOp ( self , context , producer , consumers , name , moving_avg = True , init_min = - 6.0 , init_max = 6.0 , delay_requested = True , bits = 8 , narrow_range = False , ) : scope = context + '/' + name inputs = producer . outputs [ 0 ] if moving_avg : quant = ( quant_ops . MovingAvgQuantize ( inputs , init_min = init_min , init_max = init_max , ema_decay = self . ema_decay , is_training = self . is_training , num_bits = bits , narrow_range = narrow_range , updates_collection = _UPDATE_QUANT_OPS , vars_collection = self . vars_collection , scope = scope ) ) else : quant = ( quant_ops . LastValueQuantize ( inputs , init_min = init_min , init_max = init_max , is_training = self . is_training , num_bits = bits , narrow_range = narrow_range , updates_collection = _UPDATE_QUANT_OPS , vars_collection = self . vars_collection , scope = scope ) ) if delay_requested and self . quant_delay and self . quant_delay > 0 : activate_quant = math_ops . greater_equal ( training_util . get_global_step ( ) , self . quant_delay , name = scope + '/activate_quant' ) quant = control_flow_ops . cond ( activate_quant , lambda : quant , lambda : inputs , name = scope + '/delayed_quant' ) nodes_modified_count = graph_editor . reroute_ts ( [ quant ] , [ inputs ] , can_modify = consumers ) if nodes_modified_count != len ( consumers ) : raise ValueError ( 'Some inputs not quantized for ops: [%s]' % ', ' . join ( [ consumer . name for consumer in consumers ] ) )