code: def _shape(
      input, out_type=_get_shape_out_type(), name=None
  ):  # pylint: disable=redefined-builtin,missing-docstring
      if out_type is None:
          # Only Tensorflow has a flag to control the default ouput of tf.shape and
          # uses out_type=None in the signature. For Jax and numpy, out_type is never
          # None.
          out_type = tf.shape([]).dtype
      if not hasattr(input, "shape"):
          x = np.array(input)
          input = (
              tf.convert_to_tensor(input)
              if x.dtype == np.object_
              else x
          )
      if tensorshape_util.is_fully_defined(input.shape):
          return np.array(tensorshape_util.as_list(input.shape)).astype(
              _numpy_dtype(out_type)
          )
      # NOTE: tf.shape(x) can call `tf.convert_to_tensor(x)` **twice**, so we
      # pre-emptively convert-to-tensor.
      return tf.shape(
          tf.convert_to_tensor(input), out_type=out_type, name=name
      )
  
imports: import decorator
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal.backend import numpy
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import control_flow_case
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 22 for calling a global function with example usage: _shape(input, out_type, name) and returns: tf, np