nums.numpy.squeeze#

nums.numpy.squeeze(a: nums.core.array.blockarray.BlockArray, axis=None)#

Remove single-dimensional entries from the shape of an array.

This docstring was copied from numpy.squeeze.

Some inconsistencies with the NumS version may exist.

aBlockArray

Input data.

squeezedBlockArray

The input array, but with all or a subset of the dimensions of length 1 removed. This is always a itself or a view into a.

expand_dims : The inverse operation, adding singleton dimensions reshape : Insert, remove, and combine dimensions, and resize existing ones

axis not supported.

The doctests shown below are copied from NumPy. They won’t show the correct result until you operate get().

>>> x = nps.array([[[0], [1], [2]]])  
>>> x.shape  
(1, 3, 1)
>>> nps.squeeze(x).shape  
(3,)
>>> x = nps.array([[1234]])  
>>> x.shape  
(1, 1)
>>> nps.squeeze(x).get()  
array(1234)  # 0d array
>>> nps.squeeze(x).shape  
()
>>> nps.squeeze(x)[()].get()  
array(1234)