@@ -468,11 +468,7 @@ def unstack(x, /, *, axis=0):
468
468
The ``axis`` parameter specifies the axis along which the array will be
469
469
split. of the new axis in the dimensions of the result. For example, if
470
470
``axis=0`` it will be the first dimension and if ``axis=-1`` it will be
471
- the last dimension.
472
-
473
- The result is a tuple of arrays split along ``axis``. ``unstack`` serves
474
- as the reverse operation of :py:func:`stack`, i.e., ``stack(unstack(x,
475
- axis=axis), axis=axis) == x``.
471
+ the last dimension. The result is a tuple of arrays split along ``axis``.
476
472
477
473
.. versionadded:: 2.1.0
478
474
@@ -493,6 +489,14 @@ def unstack(x, /, *, axis=0):
493
489
block : Assemble an nd-array from nested lists of blocks.
494
490
split : Split array into a list of multiple sub-arrays of equal size.
495
491
492
+ Notes
493
+ -----
494
+ ``unstack`` serves as the reverse operation of :py:func:`stack`, i.e.,
495
+ ``stack(unstack(x, axis=axis), axis=axis) == x``.
496
+
497
+ This function is equivalent to tuple(np.moveaxis(x, axis, 0)), since
498
+ iterating on an array iterates along the first axis.
499
+
496
500
Examples
497
501
--------
498
502
>>> arr = np.arange(24).reshape((2, 3, 4))
0 commit comments