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: See base class.
code: def encode(self, x, encode_params):
      """See base class."""
      dim = tf.shape(x)[-1]
      x = tf.reshape(x, [-1, dim])
  
      # Per-channel min and max.
      min_x = tf.reduce_min(x, axis=0)
      max_x = tf.reduce_max(x, axis=0)
  
      max_value = tf.cast(
          encode_params[self.MAX_INT_VALUE_PARAMS_KEY], x.dtype
      )
      # Shift the values to range [0, max_value].
      # In the case of min_x == max_x, this will return all zeros.
      x = tf.compat.v1.div_no_nan(x - min_x, max_x - min_x) * max_value
      if self._stochastic:  # Randomized rounding.
          floored_x = tf.floor(x)
          bernoulli = tf.random.uniform(tf.shape(x), dtype=x.dtype)
          bernoulli = bernoulli < (x - floored_x)
          quantized_x = floored_x + tf.cast(bernoulli, x.dtype)
      else:  # Deterministic rounding.
          quantized_x = tf.round(x)
  
      encoded_tensors = collections.OrderedDict(
          [
              (self.ENCODED_VALUES_KEY, quantized_x),
              (self.MIN_MAX_VALUES_KEY, tf.stack([min_x, max_x])),
          ]
      )
  
      return encoded_tensors
  
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 7 for calling the PerChannelUniformQuantizationEncodingStage obj's underlying member method code with example usage: obj.encode(x, encode_params) and returns: encoded_tensors