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
Incorrect array returned from guvectorize #4893
Comments
@sjster thanks for reporting this on the Numba issue tracker. It is not possible to diagnose or reproduce this w/o having access to the code. Maybe you could construct a minimal reproducer which you can submit that highlights the issue? In any case, just guessing from the numbers in the result in the caller it might be that you are seeing is an uninitialized memory region, for example created with |
I can put a self-contained code in a repository in GitHub and give you access. Would that work? |
You can access the code here https://github.com/sjster/Numba/blob/master/numba_test.py You run it as python numba_test.py and in the output there are two relevant sections.
A is correct however B is not and as you suggested probably a Numpy initialized location. The function that is accelerated by Numba is named 'numba_svd_derivative '(A) and the calling function is named 'compute_svd_derivative' (B). Please let me know if I can provide any further information. |
@sjster thanks for submitting this, it should help to figure out what is going on. Since the code seems quite involved, it may take some time to get to the bottom of this, however. |
This line is likely the problem: result[:, :] = res_elem1 + res_elem2 such that the value from the addition is assigned back into the memory allocated in the |
Thanks for the pointer and the explanation, this fixed it! |
@sjster thanks for confirming, will close the issue now as I believe it is resolved. If you encounter any Numba snags in future please don't hesitate to open an issue! Thanks. |
The results returned from the function accelerated don't match the array values in the function. The values computed in the function are correct, however when I print them out in the caller the results are different. The signature of my function is shown here
This is assigned in the caller as
I print out the result in the function and the caller as
I have verified the return types and shapes of the result array and they are both float64. Any ideas why this should happen?
The text was updated successfully, but these errors were encountered: