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

Supply custom gradient in the backward function #354

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Liby99
Copy link

@Liby99 Liby99 commented May 17, 2021

Recently I've been working on a project where I need to supply custom gradient into the back propagation process. Therefore I need an advanced backward function where I can pass in gradient, retain_graph and create_graph as parameters. That's why I introduced this new function backward_with_grad in this pull request.

I know that the documentation as well as the function name is not finalized yet in this pull request, I merely want to submit and enter the discussion of whether we can manage to add this feature to the code base. It would of great help to many other projects involving custom gradient!

@Liby99 Liby99 changed the title Adding backward with gradient function Supply custom gradient in the backward function May 17, 2021
Copy link
Owner

@LaurentMazare LaurentMazare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes look reasonable, would you have some examples to show the interest of this?
Also as you mentioned adding some documentation + test would be great.

@Liby99
Copy link
Author

Liby99 commented May 21, 2021

Thank you for your feedback; I'll work on this and get back to you in a few days.

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