This is documentation for an old release of NumPy (version 1.3.). Read this page in the documentation of the latest stable release (version > 1.17).
Remove single-dimensional entries from the shape of an array.
Parameters: | a : array_like
|
---|---|
Returns: | squeezed : ndarray
|
Examples
>>> x = np.array([[[0], [1], [2]]])
>>> x.shape
(1, 3, 1)
>>> np.squeeze(x).shape
(3,)