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

self defined gradient for certain value of input #573

Open
zyzhang1130 opened this issue Jan 8, 2022 · 1 comment
Open

self defined gradient for certain value of input #573

zyzhang1130 opened this issue Jan 8, 2022 · 1 comment

Comments

@zyzhang1130
Copy link

Is it possible to self define gradient value for certain input value where the gradient is not defined? One example would be x= 0 for f(x) = 1/x

@CamDavidsonPilon
Copy link
Contributor

Yes, but you'll need to dip into the internals of autograd library. Here's an example of creating auto-diff functions compatible with autograd: https://github.com/CamDavidsonPilon/autograd-gamma/blob/master/autograd_gamma/__init__.py

So it's possible, but requires more work.

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

3 participants
@CamDavidsonPilon @zyzhang1130 and others