code: def _cast_tensorshape(x, x_type):
      if issubclass(x_type, tf.TensorShape):
          return x
      if issubclass(x_type, np.ndarray):
          # np.ndarray default constructor will place x
          # as the shape, which we don't want.
          return np.array(as_list(x), dtype=np.int32)
      return x_type(as_list(x))
  
file_path: probability/tensorflow_probability/python/internal/tensorshape_util.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.framework import tensor_util
label_desc: Use image node_id 2 for calling a global function with example usage: _cast_tensorshape(x, x_type) and returns: x_type, x, np