Repository navigation
work around numpy 1.14.0 bug in einsum - #7105
Conversation
|
Hi there @eteq 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃. Everything looks good from my point of view! 👍 If there are any issues with this message, please report them here. |
|
@eteq - the fix is definitely OK, though I wonder why in this place one isn't using |
|
@eteq @mhvk - how do we know that numpy/numpy#10371 will be released in 1.14.1? It's milestoned to 1.15.0, though there were some backport labelling going on that I'm clearly not familiar with. |
|
@bsipocz - that one has been backported (numpy/numpy#10396). The numpy workflow is that any PR that should be backported gets labelled as such, and when that is done, the label is removed. |
|
@mhvk - Thank you, this is very useful to know I didn't notice backports are done in separate PRs. |
mhvk
left a comment
There was a problem hiding this comment.
With a bit more thought: for 2.0.4, this seems the best and easiest bug-fix, so let's just get it in. For 3.1, it may be worth reworking in terms of matmul -- we probably need to look into it anyway since there is a comment just below that the differentials should be sped up.
(And I'd also like to think a bit about defining a __rmatmul__ that takes care of it: matrix @ representation would seem pretty unambiguous).
|
The test failure is strange - why is numpy 1.14 not found? |
|
The bug happens only with Python 2, so this could go directly on the v2.0.X branch ? Also another way to fix it without having to check the numpy version would be to use |
|
@saimn - This was also an issue not only on python2, but on appveyor, too: https://ci.appveyor.com/project/Astropy/astropy/build/1.0.9904#L5357 I'm inclined to merge it now, and deal with the numpy install issue separately. |
|
Or, actually there is one related test failure, I wonder it can be dealt with here or it has to be in a new PR, too? |
|
Hmm i think the Appveyor failure is a different beast, i.e. not the one reported initially in #7051. And it looks like the remaining Travis error is the same thing. |
|
Hmm, this one now needs a rebase, I may do it in ~15 mins, after everything else is merged and ready to be backported. |
|
Rebased, and I've also added a fix for the PEP8 issue I accidentally introduced by editing #7104 on github... |
|
OK, this is now only have the numpy dev issue mentioned above, and I suggest to fix that in a separate PR. |
work around numpy 1.14.0 bug in einsum
|
OK, great! |
work around numpy 1.14.0 bug in einsum
|
I may have found another instance of this same issue. einsum() is also called in astropy/coordinates/builtin_frames/utils.py and is causing me very similar looking "TypeError: For this input type lists must contain either int or Ellipsis" errors. To replicate the error I can simply follow the "Barycentric and Heliocentric Light Travel Time Corrections" example in the astropy docs
gives the error message File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/coordinates/builtin_frames/utils.py", line 125, in norm Simply inserting "optimize=False" in the einsum() call fixes the error. I am running numpy 1.14.0, astropy 2.0.3, python 2.7 on MacOS 10.13.2 |
|
At least that is the only other occurrence in |
|
Yes, just those two occurrences I can see. The "optimize=False” worked fine for me and my code is running again. Thanks.
|
This fixes #7051 by explicitly setting the optimize keyword of
einsumtoFalse, only for numpy v1.14.0 , as the underlying bug will be fixed in 1.14.1 (numpy/numpy#10371).In passing I note that there may be a factor of ~2x speedup in 1.14.1 though, where
einsumdefaults tooptimize=True(probably because BLAS is now used in einsum). So 👏 there!