Skip to content

Fix some remainder/truncation duals#4

Open
ryan-williams wants to merge 1 commit intoelrnv:masterfrom
runsascoded:duals
Open

Fix some remainder/truncation duals#4
ryan-williams wants to merge 1 commit intoelrnv:masterfrom
runsascoded:duals

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