ivy.squeeze(x: ivy.NativeArray, axis: Optional[int] = None, f: Optional[ivy.Framework] = None) → ivy.NativeArray[source]

Removes a single-dimensional entry from the shape of an array.

  • x (array) – Input data.

  • axis (int, optional) – Index for one of the single-dimensional entries in the shape. If an axis is selected with shape entry greater than one, an error is raised.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.


The input array, but with all (axis=None) or one (axis is int) of the dimensions of length 1 removed.

Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty