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
Jitclass + numpy functions can't compile with attribute as second parameter #9522
Comments
I just noticed that a similar thing happens for MWE:
This throws the following error:
Using
This prints the expected |
This behavior is not observed when the first argument is an attribute. The error can be circumvented by creating a copy of the attribute, using |
Thanks for the report - I can reproduce the issue in the original post. I also note that calling import numpy as np
from numba import njit, int32, float64
@njit((float64[:], int32))
def Foo(a, n):
return np.broadcast_to([a], n)
Foo(1., 6) The last part of the traceback is: Traceback end
|
Labelling as a bug for now, but I think a bit of discussion in the triage meeting will help establish the right directions to take for looking further into this bug / this collection of related issues. |
After discussion in the triage meeting - the issue is that broadcasting a list is not supported - if you replace the list that's the first argument of |
@JulVandenBroeck, are you trying to broadcast a set of arrays? If so, can you try |
Thanks for the info! Using a tuple gives the same error, and so does an ndarray. It finds the appropriate candidate implementations but fails during the native lowering step.
No, I want to broadcast a single array to a certain shape: in my example an array with shape |
I decided to switch to a structref, which solved all my issues (for the moment being :) ) |
Hello everyone!
Thanks for the great work on numba.
I believe I have encountered a bug that happens when the second argument of numpy.broadcast_to is an object attribute.
Below is a MWE that triggers the bug (notice the
self.n
as the second argument ofnp.broadcast_to
):Running this code raises the following exceptions:
In contrast, using the constructor argument
n
itself gives no errors:Thanks for taking the time.
Kind regards
Jul
The text was updated successfully, but these errors were encountered: