torchjd icon indicating copy to clipboard operation
torchjd copied to clipboard

refactor(autogram): Remove vmap rule generation

Open ValerianRey opened this issue 6 months ago • 3 comments

Not sure what I'm doing here, but as far as I understand, the generated vmap rule for JacobianAccumulator is never used. I think (correct me if I'm wrong) that it would only be used if we vmapped the forward pass of a hooked model. And I don't think we will ever cover that case (it's just too much work for nothing it seems). So this is 1 less line of code, one less non-tested feature, and maybe even a lighter JacobianAccumulator node.

ValerianRey avatar Oct 18 '25 02:10 ValerianRey

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/torchjd/autogram/_module_hook_manager.py 100.00% <ø> (+100.00%) :arrow_up:

... and 51 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Oct 18 '25 02:10 codecov[bot]

I added this when we where having 2 engines on the same modules. This is because the forward was then run using vmap with the functional api. This is exactly what we lose with this change (but I don't have anything against it).

PierreQuinton avatar Oct 18 '25 15:10 PierreQuinton

Ok, then I'm not sure this PR is such a good idea. I'm gonna keep this open for now.

ValerianRey avatar Oct 19 '25 16:10 ValerianRey