code: def as_shape(shape):
      """Converts the given object to a TensorShape."""
      if isinstance(shape, TensorShape):
          return shape
      else:
          return TensorShape(shape)
  
imports: from .None import compat, dtypes
  from tensorboard.compat.proto import tensor_shape_pb2
label_desc: Use image node_id 2 for calling a global function with example usage: as_shape(shape) and returns: shape, TensorShape