code: def squeeze(a, axis=None):
      """
      Remove single-dimensional entries from the shape of a tensor.
  
      Parameters
      ----------
      a : array_like
          Input data.
      axis : None or int or tuple of ints, optional
          Selects a subset of the single-dimensional entries in the
          shape. If an axis is selected with shape entry greater than
          one, an error is raised.
  
      Returns
      -------
      squeezed : Tensor
          The input tensor, but with all or a subset of the
          dimensions of length 1 removed. This is always `a` itself
          or a view into `a`.
  
      Raises
      ------
      ValueError
          If `axis` is not `None`, and an axis being squeezed is not of length 1
  
      See Also
      --------
      expand_dims : The inverse operation, adding singleton dimensions
      reshape : Insert, remove, and combine dimensions, and resize existing ones
  
      Examples
      --------
      >>> import mars.tensor as mt
  
      >>> x = mt.array([[[0], [1], [2]]])
      >>> x.shape
      (1, 3, 1)
      >>> mt.squeeze(x).shape
      (3,)
      >>> mt.squeeze(x, axis=0).shape
      (3, 1)
      >>> mt.squeeze(x, axis=1).shape
      Traceback (most recent call last):
      ...
      ValueError: cannot select an axis to squeeze out which has size not equal to one
      >>> mt.squeeze(x, axis=2).shape
      (1, 3)
  
      """
      shape, axis = _get_squeeze_shape(a.shape, axis)
  
      if 1 not in a.shape:
          return a
  
      op = TensorSqueeze(axis=axis, dtype=a.dtype, sparse=a.issparse())
      return op(a, shape)
  
file_path: mars/mars/tensor/base/squeeze.py
imports: from collections.abc import Iterable
  from ...serialization.serializables import FieldTypes, KeyField, TupleField
  from ...None import opcodes
  from ..operands import TensorHasInput, TensorOperandMixin
  from ..array_utils import as_same_device, device
label_desc: Use image node_id 2 for calling a global function with example usage: squeeze(a, axis) and returns: op, a