Skip to content
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

Kernel never returns from np.prod() on quaternions #54

Closed
noncom opened this issue Jul 1, 2017 · 8 comments
Closed

Kernel never returns from np.prod() on quaternions #54

noncom opened this issue Jul 1, 2017 · 8 comments

Comments

@noncom
Copy link

noncom commented Jul 1, 2017

Performing the prod NumPy operation over an array of quaternions results in kernel becoming unresponsive and producing a 100% CPU load. Only restarting the kernel would bring the notebook back to life.

Example code:

np.prod([np.quaternion(1, 0, 0, 0), np.quaternion(0, 0, 0, 1)])
@moble
Copy link
Owner

moble commented Jul 2, 2017

I can verify that this happens with the newest versions of everything. I've tracked it back to the numpy.core.umath.multiply.reduce function. Here's a MWE:

import numpy as np
from numpy.core import umath as um
import quaternion

a = np.array([quaternion.x, quaternion.y])
um.multiply.reduce(a, axis=None, dtype=None, out=None, keepdims=False)

Unfortunately, I can't actually find where that function is defined, because I would hope to pass the buck to the numpy maintainers...

@eric-wieser Since you seem to know something about both repos, any thoughts?

@eric-wieser
Copy link
Contributor

numpy\core\src\umath\ufunc_object.c:PyUFunc_Reduce is the place to start looking. That does indeed seem odd.

However, it works fine on np.core.test_rational.rational - so my hunch is that your multiply inner loop is broken

@eric-wieser
Copy link
Contributor

eric-wieser commented Jul 2, 2017

np.multiply.reduce(a[:0]) shows the same problem, which is interesting

@eric-wieser
Copy link
Contributor

The hang is within type_tuple_type_resolver.

@eric-wieser
Copy link
Contributor

This is a numpy bug, in type_tuple_userloop_type_resolver, where there is an obvious inner loop.

Please file an issue upstream!

@eric-wieser
Copy link
Contributor

*infinite loop

@moble
Copy link
Owner

moble commented Jul 2, 2017

Thanks! Issue filed. I'll keep an eye on that to test any fixes, and I'll leave this open until the fix makes it into a numpy release.

@moble
Copy link
Owner

moble commented Aug 11, 2017

The changes have filtered down to the conda package, so this issue is resolved. Thanks everyone!

@moble moble closed this as completed Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants