code: def static_or_dynamic_shape(value):
      """Returns shape of the input `Tensor` or a `np.ndarray`.
  
      If `value` is a `np.ndarray` or a `Tensor` with statically known shape, it
      returns a Python object. Otherwise, returns result of `tf.shape(value)`.
  
      Args:
        value: A `Tensor` or a `np.ndarray` object.
  
      Returns:
        Static or dynamic shape of `value`.
  
      Raises:
        TypeError:
          If the input is not a `Tensor` or a `np.ndarray` object.
      """
      if tf.is_tensor(value):
          return (
              value.shape
              if value.shape.is_fully_defined()
              else tf.shape(value)
          )
      elif isinstance(value, np.ndarray):
          return value.shape
      else:
          raise TypeError(
              "The provided input is not a Tensor or numpy array."
          )
  
file_path: model-optimization/tensorflow_model_optimization/python/core/internal/tensor_encoding/utils/py_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import enum
  import numpy
  import six
  import tensorflow
  import tree
label_desc: Use image node_id 1 for calling a global function with example usage: static_or_dynamic_shape(value) and returns: unknown, value