-
Notifications
You must be signed in to change notification settings - Fork 914
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
Support numpy.mgrid #623
Comments
I'm interested in contributing if someone hasn't already started working on it. As I understand (correct me if I am wrong), most of the work should lie in figuring out whether mgrid should be a primitive and if it is write a vjp for it, otherwise copy the numpy implementation. |
Hey @99991 and @Karthik-Dulam, autograd actually already supports
The error you reported only occured because autograd was not compatible with numpy 2. In the meantime, we released autograd 1.7 which fully supports numpy 2 and the |
@fjosw I do not have permission to reopen this issue. Could you reopen? This issue is about $ pip freeze | grep -P 'autograd|numpy'
autograd==1.7.0
numpy==2.1.1
$ python3
Python 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import autograd.numpy as np
>>> np.mgrid[:3, :4]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'autograd.numpy' has no attribute 'mgrid' NumPy 2 still supports >>> import numpy
>>> numpy.mgrid[:3, :4]
array([[[0, 0, 0, 0],
[1, 1, 1, 1],
[2, 2, 2, 2]],
[[0, 1, 2, 3],
[0, 1, 2, 3],
[0, 1, 2, 3]]]) |
Oh, I'm sorry for the confusion. i reopened the issue. |
No worries. Thanks for reopening. |
One more question: Do you really need
and then use this array as input for function you would like to derive with |
Personally, I do not need the derivative. I just do not want to change my code when switching between I do not know whether there are applications where a derivative with |
Thanks for clarifying. I create a draft PR for adding a few index tricks to |
Support for
numpy.mgrid
would be nice.The text was updated successfully, but these errors were encountered: