code: def squeeze(
      x: torch.Tensor,
      /,
      *,
      axis: Optional[Union[int, Sequence[int]]] = None,
      copy: Optional[bool] = None,
      out: Optional[torch.Tensor] = None,
  ) -> torch.Tensor:
      if isinstance(axis, int):
          if x.size(dim=axis) > 1:
              raise ValueError(
                  f"Expected dimension of size [{-x.dim()}, {x.dim()}], but found"
                  f" dimension size {axis}"
              )
          if x.shape[axis] != 1:
              raise ivy.utils.exceptions.IvyException(
                  f"Expected size of axis to be 1 but was {x.shape[axis]}"
              )
          return torch.squeeze(x, axis)
      if axis is None:
          if copy:
              newarr = torch.clone(x)
              return torch.squeeze(newarr)
          return torch.squeeze(x)
      newarr = torch.clone(x)
      if isinstance(axis, tuple):
          axis = list(axis)
      normalise_axis = [
          (len(x.shape) - abs(element)) if element < 0 else element
          for element in axis
      ]
      normalise_axis.sort()
      axis_updated_after_squeeze = [
          dim - key for (key, dim) in enumerate(normalise_axis)
      ]
      dim = x.dim()
      for i in axis_updated_after_squeeze:
          shape = x.shape[i]
          if shape > 1 and (shape < -dim or dim <= shape):
              raise ValueError(
                  f"Expected dimension of size [{-dim}, {dim}], but found dimension size"
                  f" {shape}"
              )
          else:
              if copy:
                  newarr = torch.squeeze(newarr, i)
              else:
                  x = torch.squeeze(x, i)
      if copy:
          return newarr
      return x
  
imports: import math
  from numbers import Number
  from typing import Union, Optional, Tuple, List, Sequence, Iterable
  import torch
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from ivy.functional.ivy.manipulation import _calculate_out_shape
  from .None import backend_version
label_desc: Use image node_id 8 for calling a global function with example usage: squeeze() and returns: x, torch, torch, newarr, torch