-
Notifications
You must be signed in to change notification settings - Fork 23
Add tips & tricks for custom diffs article #144
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
Conversation
csyonghe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it maybe useful to add one or more concrete slang code snippets to demonstrate how to solve that particular problem in each section.
…ll provide custom derivatives if you want.
I am going to need assistance on this part. |
…max() and clamp()
Okay, I've constructed some very basic sample snippets, but please check them to make sure they're illustrative, correct, and a sane way to address the specified issues. |
docs/autodiff-tips-custom-diffs.md
Outdated
| float denomStable = denominator.p + epsilon; | ||
| // Clamp gradients to prevent explosion when denominator is very small | ||
| float dNumerator = clamp(dOut / denomStable, -maxGradient, maxGradient); | ||
| float dDenominator = clamp(-dOut * numerator / (denomStable * denomStable), -maxGradient, maxGradient); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
numerator.p
No description provided.