autodiff
autodiff copied to clipboard
Fix some remainder/truncation duals
I could be wrong about these, but:
- Removed a few places were the
%operator was applied to thedxcomponent (that should basically never happen, afaict) - Set
dxto 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 thedxcomponent 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.
I think you are right! Thank you for the PR. It would be awesome to have more tests here!