class_docstr: Encoding stage performing uniform quantization per channel in conv layers.
  
  This encoding stage will first reshape the input `x` to `(-1, dim)`, where
  `dim` is the size of the last dimension of `x`. Then each of the `dim`
  vectors will be quantized independently.
  
  This encoding stage does not require the shape of the input `x` to the
  `encode` method to be statically known.
  
  In particular, given a floating point input `x` to the `encode` method, the
  output will have the same `dtype` as `x`, with values being "floating point
  integers" in the range `[0, 2**bits-1]`.
  
  The extreme points of the quantized interval will correspond to the min and
  max values of the input `x`.
docstr: Initializer for the PerChannelUniformQuantizationEncodingStage.
  
  Args:
    bits: The number of bits to quantize to. Must be an integer between 1 and
      16. Can be either a TensorFlow or a Python value.
    stochastic: A Python bool, whether to use stochastic or deterministic
      rounding. If `True`, the encoding is randomized and on expectation
      unbiased. If `False`, the encoding is deterministic.
  
  Raises:
    ValueError: The inputs do not satisfy the above constraints.
code: def __init__(self, bits=8, stochastic=True):
      """Initializer for the PerChannelUniformQuantizationEncodingStage.
  
      Args:
        bits: The number of bits to quantize to. Must be an integer between 1 and
          16. Can be either a TensorFlow or a Python value.
        stochastic: A Python bool, whether to use stochastic or deterministic
          rounding. If `True`, the encoding is randomized and on expectation
          unbiased. If `False`, the encoding is deterministic.
  
      Raises:
        ValueError: The inputs do not satisfy the above constraints.
      """
      if not tf.is_tensor(bits) and bits not in self._ALLOWED_BITS_ARG:
          raise ValueError(
              "The bits argument must be an integer between 1 and 16."
          )
      self._bits = bits
  
      if not isinstance(stochastic, bool):
          raise TypeError("The stochastic argument must be a bool.")
      self._stochastic = stochastic
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import tensorflow
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.core import encoding_stage
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.utils import tf_utils
label_desc: Use image node_id 1 to create a new PerChannelUniformQuantizationEncodingStage object from inherited base classes: encoding_stage with example: obj = PerChannelUniformQuantizationEncodingStage(bits, stochastic)