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

Gradients are not preserved in torch #36

Closed
frazane opened this issue Aug 19, 2024 · 0 comments · Fixed by #79
Closed

Gradients are not preserved in torch #36

frazane opened this issue Aug 19, 2024 · 0 comments · Fixed by #79
Assignees
Labels
bug Something isn't working

Comments

@frazane
Copy link
Owner

frazane commented Aug 19, 2024

When using asarray() in the torch backend, if called on a pre-existing tensor it will delete its autograd history by default (see https://pytorch.org/docs/stable/generated/torch.asarray.html). Consequently, one cannot compute gradients on functions that include asarray().

We need to use as_tensor() instead, or use asarray(*args, requires_grad=True).

@frazane frazane added the bug Something isn't working label Aug 19, 2024
@frazane frazane self-assigned this Aug 19, 2024
@frazane frazane changed the title Preserve autograd history in torch backend Gradients are not preserved in torch Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant