def METHOD_NAME(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.')