Skip to content
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 a new release? #576

Closed
cvjjm opened this issue Apr 5, 2022 · 2 comments
Closed

Make a new release? #576

cvjjm opened this issue Apr 5, 2022 · 2 comments

Comments

@cvjjm
Copy link

cvjjm commented Apr 5, 2022

It seems that the 1.3 release of autograd that is available via pypi has a few bugs that are fixed in the current master.

As an example consider this code:

from autograd import numpy as np
from autograd import jacobian
def g(m):
    return np.linalg.eigh(m)[1]
m = np.array([[1, 2],[2, 3]])
dg_dm = jacobian(g)(m)
print(dg_dm)

delta = 1e-6
dg_dm_fd = np.zeros(list(m.shape)*2)
for x in range(len(m)):
    for y in range(len(m)):
        if y > x:
            continue
        displacement = np.zeros_like(m, dtype=float)
        displacement[x, y] = delta
        if x != y:
            displacement[y, x] = delta
        #print(delta, displacement, (g(m+displacement) - g(m-displacement))/(2*delta))
        dg_dm_fd[x, y] += (g(m+displacement) - g(m-displacement))/(2*delta)

dg_dm_fd = dg_dm_fd.transpose((2, 3, 0, 1))
print(dg_dm_fd)
assert np.allclose(dg_dm, dg_dm_fd), str(dg_dm - dg_dm_fd)

which works correctly with master but fails with pip install autograd.

Would be awesome if a 1.4 release could be made so that code that depends on this working can declare a dependency on autograd 1.4. Thanks very much!

@j-towns
Copy link
Collaborator

j-towns commented Apr 8, 2022

Done, hope that helps!

@j-towns j-towns closed this as completed Apr 8, 2022
@cvjjm
Copy link
Author

cvjjm commented Apr 8, 2022

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants