Repository navigation
ENH,DEP: Allow multiple axes in expand_dims - #14051
Conversation
9ee4962 to
0866b94
Compare
4157dd9 to
d3095db
Compare
eric-wieser
left a comment
There was a problem hiding this comment.
Whoops, pending comments from ages ago
d3095db to
c8b4db4
Compare
There was a problem hiding this comment.
This needs two release notes:
14051.new_feature.txt, stating that a tuple of axes can be passed14051.expired.txt, stating that the deprecation of out-of-range axes from 1.13.0 has expired.
Have a look at the other files in that directory for examples of how to write these.
c8b4db4 to
9aad22b
Compare
|
@eric-wieser I've added the release notes. |
9aad22b to
17fdedd
Compare
17fdedd to
42af872
Compare
|
@eric-wieser Can this be merged now? Is there anything else I need to do? |
3b25117 to
ad986d5
Compare
ad986d5 to
22f5493
Compare
22f5493 to
d83b781
Compare
eric-wieser
left a comment
There was a problem hiding this comment.
Release notes have a typo, otherwise looks good.
Milestoning for 1.18.0 simply because the PR text contains 1.18.0, and it would be a shame to have to rebase
|
@larrybradley, I don't have permission to commit the changes above myself through the web gui as you haven't ticked "allow maintainers to make changes" |
|
@charris, shall we merge as is and fixup the release note later? |
Co-Authored-By: Eric Wieser <[email protected]>
Co-Authored-By: Eric Wieser <[email protected]>
Co-Authored-By: Eric Wieser <[email protected]>
|
@eric-wieser I actually do have the option selected to allow edits from maintainers. I'm not sure why you couldn't commit. I accepted all your suggestions. Thanks! |
eric-wieser
left a comment
There was a problem hiding this comment.
Looks great to me, thanks. @seberg, any final comments?
I suppose in principle this could hit the mailing list, but this seems like such a natural extension it seems necessary.
seberg
left a comment
There was a problem hiding this comment.
Generally looks good to me, one more small behaviour thing and doc nitpick. Negative axis are a bit more confusing with multiple insertions :). Since the old was also the axis in the expanded array, it does seem very straight forward. I am happy with putting it in right away 1.18, but out of principle, lets just ping the list.
| # and uncomment the following line. | ||
| # axis = normalize_axis_index(axis, a.ndim + 1) | ||
| return a.reshape(shape[:axis] + (1,) + shape[axis:]) | ||
| if type(axis) not in (tuple, list): |
There was a problem hiding this comment.
Looks good, even only tuple would probably be OK.
04f72c2 to
6411a54
Compare
6411a54 to
fcc1ec0
Compare
|
Thanks Larry and Eric, lets put this in. I do not expect any more replies on the mailing list, except maybe one or two cheers ;). |
This PR allows the
axiskeyword inexpand_dimsto be a tuple ofints. Previously,axiscould only be anint.This issue was previously discussed in #12290 and the changes are based on #12290 (comment).
This PR also removes the deprecation added in v1.13 (2017-05-17), where previously
axiscould be outside of the range(-a.ndim - 1) <= axis <= a.ndim. Such anaxisvalue will now raise anAxisError. Please let me know if it's too soon to remove this deprecation (I could not find any dev docs stating the length of thenumpydeprecation cycle).Closes #12290.