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

Fix some remainder/truncation duals #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ryan-williams
Copy link

@ryan-williams ryan-williams commented Aug 9, 2023

I could be wrong about these, but:

  • Removed a few places were the % operator was applied to the dx component (that should basically never happen, afaict)
  • Set dx to 0 in a few cases (floor, ceil, round, etc). These functions are flat everywhere they're differentiable, epsilon perturbations will always leave the value unchanged, so the dx component should be wiped out by them, unless I'm mistaken.

I considered adding tests but simple tests would just repeat my assumptions about how the math should work (e.g. asserting dx == 0 in some cases). It would be nice to add tests that perturb values by EPSILON, and verify that the empirical and theoretical gradients match. I'm open to trying that out, but maybe as a follow-on PR, as ≈all of the operations warrant that, not just the ones I've touched here.

@elrnv
Copy link
Owner

elrnv commented Aug 14, 2023

I think you are right! Thank you for the PR.
It would be awesome to have more tests here!

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