-
Notifications
You must be signed in to change notification settings - Fork 237
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
Broadcasting of Arrays and non-scalar but unit-sized numpy arrays #505
Comments
Replacing or augmenting with
Oops, that's a bug. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After 78bedd8, binary operations between a unit-sized numpy array and a PyOpenCL array ends up looping over each element of the CL array.
Namely,
pyopencl.Array.__add__
returnsNotImplemented
in this case and so python then asks the numpy array what to do. It appears numpy chooses to loop over each scalar element of the CL array and call its__add__
method, and for some reason converts the unit-sized array into a scalar (which is why the single-element additions don't fail).Could the
np.isscalar(other)
check be replaced (or augmented with)other.size == 1
, perhaps?Also, a few binary ops were missed in 78bedd8, like
__iadd__
and comparisons - was this intentional?cc @kaushikcfd
The text was updated successfully, but these errors were encountered: