-
Notifications
You must be signed in to change notification settings - Fork 912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[numpy 1.8.x] Array slices broken? #52
Comments
Hi Andy, thanks for the bug report and for the nice minimal test case! I think the issue is with numpy versions. Your test case works fine on my system, which has numpy 1.9.1. Is it possible that you're using an older version of numpy? Numpy's ufunc.add.at is supposed to support slices but maybe older versions don't? We ought to figure out which versions work and either list them as dependencies or implement a fallback option. I added a version of your test to our test suite. Can you confirm that this test fails for you? |
Hmm! It seems to be a Mac system numpy issue on my end, with both Yosemite and El Capitan. I have two computers (both Macs), one Yosemite with numpy 1.10.0.post2 and one El Capitan with 1.8.0rc1, and both fail the test. Both also segfault trying to run nosetests. I have an AWS node running Ubuntu with numpy 1.10.1 and that works just fine. And a Raspberry Pi 2 with numpy 1.10.1, also works fine. El Capitan prevents me from upgrading the system numpy. If I upgrade to numpy 1.10.1 in a virtualenv, it works fine. And running nosetests no longer segfaults (though there are other unit test failures... I can open separate issues on those if you wish?) |
...and on Yosemite I just upgraded to numpy 1.10.1, and I still get the same error, so it's definitely the mac system python that is unhappy about this, somehow. Weird. I'll dig a little more. |
Ok, yeah, this is definitely a mac system numpy issue, nothing to do with autograd. Minimal test case is
Closing. It turns out that the system Python includes numpy 1.8.0rc1, and attempting to upgrade it with pip actually doesn't work. Thanks @dougalm for a really great library! |
Ah, hang on. I was just checking the version dependency you brought up in your original comment, numpy==1.8.0 also fails the test, as does 1.8.1 and 1.8.2! 1.9.0 is actually the first version which passes the test. So... I guess maybe the minimum requirement should be bumped up after all. |
Thanks for the thorough testing! I bumped the numpy version requirement in setup.py to 1.9, hopefully that's the fix you had in mind. |
Indeed it was, thanks! I suppose it would be possible to support 1.8 by expanding the slice object but it's definitely not worth it. |
See the following test case:
produces
(2.0, array([ 1., 1., 1., 1.]))
, naturally.The identical code using array slices for
a
andb
:throws an exception in
autograd/numpy/numpy_extra.pyc
on line 123 inprimitive_sum_arrays(*arrays)
, trying to callnp.add.at
. I haven't figured out which argument is the slice here.The text was updated successfully, but these errors were encountered: