-
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
Make __setitem__ to fill all subscript positions even if size of values array is less than subscript size. #72
Comments
Good catch. Can you provide a patch? |
Works for me on a one-dimensional arrays, but I can't run all the tests provided, because on my laptop I have only two buggy opencl implementations - pocl and beignet. It anyway crashes with as without my changes.
|
I'm not quite happy with this, for two reasons:
|
Agree with that. But hardcoding value into kernel needs recompilation each time. 2-step broadcasting over local data may be an solution. Is there for now any way to do this with pyopencl? If isn't, any extension for ElementwiseKernel to work with array and single value would be also helpful. |
Passing a kernel argument seems like a good solution--you do have to bake the type into the kernel (but you have to do that anyway), but the can be provided at runtime. |
@inducer Currently working on a solution to this. If we don't want to use "modulo mode" in the general case, does it make sense to throw an Exception if the indices array and the source array have different lengths (of course excluding the case where the source array has |
Upon reconsidering this, I'm OK with (and will take patches for) either (a) matching |
It's needed to be more compatible with numpy. For example:
Also, as I observed in other cases, numpy is using equation like
values[n%values.size]
(where n is current subscription position) to get value for current subscription index. For example:I think, it is possible to make custom kernels for cases like:
The text was updated successfully, but these errors were encountered: