This is documentation for an old release of NumPy (version 1.7.0). 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
axis : None or int or tuple of ints, optional
|
---|---|
Returns : | squeezed : ndarray
|
Examples
>>> x = np.array([[[0], [1], [2]]])
>>> x.shape
(1, 3, 1)
>>> np.squeeze(x).shape
(3,)
>>> np.squeeze(x, axis=(2,)).shape
(1, 3)