squeeze(a, axis=None)
This docstring was copied from numpy.squeeze.
Some inconsistencies with the Dask version may exist.
Input data.
Selects a subset of the entries of length one in the shape. If an axis is selected with shape entry greater than one, an error is raised.
If :None:None:`axis`
is not None, and an axis being squeezed is not of length 1
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
. Note that if all axes are squeezed, the result is a 0d array and not a scalar.
Remove axes of length one from a
.
expand_dims
The inverse operation, adding entries of length one
reshape
Insert, remove, and combine dimensions, and resize existing ones
>>> x = np.array([[[0], [1], [2]]]) # doctest: +SKIPThis example is valid syntax, but we were not able to check execution
... x.shape # doctest: +SKIP (1, 3, 1)
>>> np.squeeze(x).shape # doctest: +SKIP (3,)This example is valid syntax, but we were not able to check execution
>>> np.squeeze(x, axis=0).shape # doctest: +SKIP (3, 1)This example is valid syntax, but we were not able to check execution
>>> np.squeeze(x, axis=1).shape # doctest: +SKIP Traceback (most recent call last): ... ValueError: cannot select an axis to squeeze out which has size not equal to oneThis example is valid syntax, but we were not able to check execution
>>> np.squeeze(x, axis=2).shape # doctest: +SKIP (1, 3)This example is valid syntax, but we were not able to check execution
>>> x = np.array([[1234]]) # doctest: +SKIPThis example is valid syntax, but we were not able to check execution
... x.shape # doctest: +SKIP (1, 1)
>>> np.squeeze(x) # doctest: +SKIP array(1234) # 0d arrayThis example is valid syntax, but we were not able to check execution
>>> np.squeeze(x).shape # doctest: +SKIP ()This example is valid syntax, but we were not able to check execution
>>> np.squeeze(x)[()] # doctest: +SKIP 1234See :
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them