code: def _FakeQuantWithMinMaxVars(
      inputs, min_var, max_var, per_channel, num_bits, narrow_range
  ):
      """Adds a fake quantization operation.
  
      Depending on value of per_channel, this operation may do global quantization
      or per channel quantization.  min_var and max_var should have corresponding
      shapes: [1] when per_channel == False and [d] when per_channel == True.
  
      Args:
        inputs: a tensor containing values to be quantized.
        min_var: a variable containing quantization range lower end(s).
        max_var: a variable containing quantization range upper end(s).
        per_channel: a boolean specifying whether to use per-channel quantization.
        num_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^num_bits - 1] or wide range [0; 2^num_bits - 1].
      Returns:
        a tensor containing quantized values.
      """
  
      if per_channel:
          assert len(min_var.get_shape()) == 1
          assert len(max_var.get_shape()) == 1
          return (
              tf.quantization.fake_quant_with_min_max_vars_per_channel(
                  inputs,
                  min_var,
                  max_var,
                  num_bits=num_bits,
                  narrow_range=narrow_range,
              )
          )
      else:
          assert (
              min_var.get_shape() == []
          )  # pylint: disable=g-explicit-bool-comparison
          assert (
              max_var.get_shape() == []
          )  # pylint: disable=g-explicit-bool-comparison
          return tf.quantization.fake_quant_with_min_max_vars(
              inputs,
              min_var,
              max_var,
              num_bits=num_bits,
              narrow_range=narrow_range,
          )
  
file_path: model-optimization/tensorflow_model_optimization/python/core/quantization/keras/quant_ops.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from tensorflow_model_optimization.python.core.keras import compat
label_desc: Use image node_id 5 for calling a global function with example usage: _FakeQuantWithMinMaxVars(inputs, min_var, max_var, per_channel, num_bits, narrow_range) and returns: tf, tf