Skip to content

switch usage of torch.autograd.functional.vjp to torch.autograd.grad … #23

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

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

porterchild
Copy link
Contributor

…(30% faster)

They give the same numeric result, but torch.autograd.grad is a more standard usage, and performance is better for this use case. torch.autograd.functional.vjp is unnecessary because there's no custom input to the pullback, and it was implicitly calling the pullback with the normal unit vector, which is exactly what torch.autograd.grad does anyway

…(30% faster)

They give the same numeric result, but torch.autograd.grad is a more standard usage, and performance is better for this use case.
torch.autograd.functional.vjp is unnecessary because there's no custom input to the pullback, and it was implicitly calling the pullback with the normal unit vector, which is exactly what torch.autograd.grad does anyway
@porterchild porterchild force-pushed the improve-pytorch-usage branch from 6a643d3 to 8b4ae84 Compare April 11, 2024 02:06
@JaapWijnen JaapWijnen merged commit aac5bb1 into PassiveLogic:main Apr 11, 2024
2 checks passed
@porterchild porterchild deleted the improve-pytorch-usage branch April 12, 2024 17:55
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

Successfully merging this pull request may close these issues.

2 participants