class_docstr: Test for PerChannelPRNGUniformQuantizationEncodingStage.
class_docstr_tok: ["Test","for","PerChannelPRNGUniformQuantizationEncodingStage","."]
code: def test_dynamic_input_shape(self):
      # Tests that encoding works when the input shape is not statically known.
      stage = (
          quantization.PerChannelPRNGUniformQuantizationEncodingStage(
              bits=8
          )
      )
      shape = [10, 5, 7]
      prob = [0.5, 0.8, 0.6]
      original_x = tf.compat.v1.random.poisson(
          1.5, shape, dtype=tf.float32
      )
      rand = [
          tf.random.uniform(
              [
                  shape[i],
              ],
              dtype=tf.float32,
          )
          for i in range(3)
      ]
      sample_indices = [
          tf.reshape(tf.where(rand[i] < prob[i]), [-1])
          for i in range(3)
      ]
      x = tf.gather(original_x, sample_indices[0], axis=0)
      x = tf.gather(x, sample_indices[1], axis=1)
      x = tf.gather(x, sample_indices[2], axis=2)
  
      encode_params, decode_params = stage.get_params()
      encoded_x, decoded_x = self.encode_decode_x(
          stage, x, encode_params, decode_params
      )
      test_data = test_utils.TestData(x, encoded_x, decoded_x)
      test_data = self.evaluate_test_data(test_data)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.stages.research import quantization
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.testing import test_utils
label_desc: Use image node_id 11 for calling the PerChannelPRNGUniformQuantizationEncodingStageTest obj's underlying member method code with example usage: obj.test_dynamic_input_shape() without return types