squeeze

squeeze(x: array, /, axis: int | Tuple[int, ...]) array

Removes singleton dimensions (axes) from x.

Parameters:
  • x (array) – input array.

  • axis (Union[int, Tuple[int, ...]]) – axis (or axes) to squeeze.

Returns:

out (array) – an output array having the same data type and elements as x.

Raises:

ValueError – If a specified axis has a size greater than one (i.e., it is not a singleton dimension), a ValueError should be raised.