parameters: (self, block, idx, in_var, quant_bits)
return_statement: return quant_dequant_var
docstring: Inset abs max fake quant op.
docstring_summary: Inset abs max fake quant op.
docstring_tokens: Inset abs max fake quant op .
function: def _insert_abs_max_fq_op(self, block, idx, in_var, quant_bits):
          """
          Inset abs max fake quant op.
          """
          quant_dequant_var = block.create_var(
              type=in_var.type,
              name="{}.quant_dequant".format(in_var.name),
              shape=in_var.shape,
              dtype=in_var.dtype)
          scale_var = self._helper.create_parameter(
              attr=ParamAttr(
                  name="{}.quant_dequant.scale".format(in_var.name),
                  initializer=Constant(0.),
                  trainable=False),
              shape=[1],
              dtype=in_var.dtype)
          scale_var.stop_gradient = True
  
          inputs = {'X': in_var}
          outputs = {'Out': quant_dequant_var, 'OutScale': scale_var}
          attrs = {'bit_length': quant_bits}
          block._insert_op(
              idx,
              type='fake_quantize_dequantize_abs_max',
              attrs=attrs,
              inputs=inputs,
              outputs=outputs)
          return quant_dequant_var
function_tokens: def _insert_abs_max_fq_op ( self , block , idx , in_var , quant_bits ) : quant_dequant_var = block . create_var ( type = in_var . type , name = "{}.quant_dequant" . format ( in_var . name ) , shape = in_var . shape , dtype = in_var . dtype ) scale_var = self . _helper . create_parameter ( attr = ParamAttr ( name = "{}.quant_dequant.scale" . format ( in_var . name ) , initializer = Constant ( 0. ) , trainable = False ) , shape = [ 1 ] , dtype = in_var . dtype ) scale_var . stop_gradient = True inputs = { 'X' : in_var } outputs = { 'Out' : quant_dequant_var , 'OutScale' : scale_var } attrs = { 'bit_length' : quant_bits } block . _insert_op ( idx , type = 'fake_quantize_dequantize_abs_max' , attrs = attrs , inputs = inputs , outputs = outputs ) return quant_dequant_var