[Numpy-discussion] [API] (minor change) Allow multiple axes in `expand_dims`
Sebastian Berg
sebastian at sipsolutions.net
Mon Dec 2 14:13:23 EST 2019
Hi all,
Pull request 14051:
https://github.com/numpy/numpy/pull/14051
means that `np.expand_dims` now accepts multiple axes in the `axis`
argument. As before, the axis signal where a new axis is in the output
array. From the new tests:
a = np.empty((3, 3, 3))
np.expand_dims(a, axis=(0, 1, 2)).shape == (1, 1, 1, 3, 3, 3)
np.expand_dims(a, axis=(0, -1, -2)).shape == (1, 3, 3, 3, 1, 1)
np.expand_dims(a, axis=(0, 3, 5)).shape == (1, 3, 3, 1, 3, 1)
np.expand_dims(a, axis=(0, -3, -5)).shape == (1, 1, 3, 1, 3, 3)
We believe this is an uncontroversial generalization, but pinging the
mailing list since it is an API change. If anyone is concerned please I
will be happy to revert, otherwise this is expected to be included in
1.18.
Cheers,
Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20191202/d9cf5080/attachment.sig>
More information about the NumPy-Discussion
mailing list