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. If a specified axis has a size greater than one, a ValueError must be raised.

Returns:

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