class_docstr: Tests for `static_or_dynamic_shape` method.
class_docstr_tok: ["Tests","for","`","static_or_dynamic_shape","`","method","."]
code: def test_static_or_dynamic_shape(self):
      # Tensor with statically known shape.
      x = tf.constant([0.0, 2.0, -1.5])
      self.assertAllEqual((3,), py_utils.static_or_dynamic_shape(x))
  
      # Tensor without statically known shape.
      x = tf.squeeze(tf.where(tf.less(tf.random.uniform([10]), 0.5)))
      shape = py_utils.static_or_dynamic_shape(x)
      self.assertIsInstance(shape, tf.Tensor)
      x, shape = self.evaluate([x, shape])
      self.assertLen(x, shape)
  
      # Numpy value.
      x = np.array([0.0, 2.0, -1.5])
      self.assertAllEqual((3,), py_utils.static_or_dynamic_shape(x))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.internal.tensor_encoding.utils import py_utils
label_desc: Use image node_id 1 for calling the StaticOrDynamicShapeTest obj's underlying member method code with example usage: obj.test_static_or_dynamic_shape() without return types