Skip to content

feat(autogram): Use new engine#476

Open
ValerianRey wants to merge 5 commits intomainfrom
dev-new-engine
Open

feat(autogram): Use new engine#476
ValerianRey wants to merge 5 commits intomainfrom
dev-new-engine

Conversation

@ValerianRey
Copy link
Contributor

@ValerianRey ValerianRey commented Oct 29, 2025

Already making the PR to keep track of progress, and to be able to update the dev-new-engine branch easily when main is updated.

* Remove batch_dim parameter from Engine
* Remove test_batched_non_batched_equivalence and test_batched_non_batched_equivalence_2
* Adapt all usages of Engine to not provide batch_dim
* Remove FunctionalJacobianComputer
* Remove args and kwargs from interface of JacobianComputer, GramianComputer and JacobianAccumulator because they were only needed for the functional interface
* Remove kwargs from interface of Hook and stop registering it with with_kwargs=True (args are mandatory though, so rename them as _).
* Change JacobianComputer to compute generalized jacobians (shape [m0, ..., mk, n]) and change GramianComputer to compute optional generalized gramians (shape [m0, ..., mk, mk, ..., m0])
* Change engine.compute_gramian to always simply do one vmap level per dimension of the output, without caring about the batch_dim.
* Remove all reshapes and movedims in engine.compute_gramian: we don't need reshape anymore since the gramian is directly a generalized gramian, and we dont need movedim anymore since we vmap on all dimensions the same way, without having to put the non-batched dim in front. Merge compute_gramian and _compute_square_gramian.
* Add temporary function to create the inital jac_output (dense). This should be updated to a tensor format that is optimized for batched computations.
@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/torchjd/autogram/_engine.py 100.00% <100.00%> (ø)
src/torchjd/autogram/_gramian_computer.py 100.00% <100.00%> (ø)
src/torchjd/autogram/_jacobian_computer.py 100.00% <100.00%> (ø)
src/torchjd/autogram/_module_hook_manager.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ValerianRey ValerianRey added cc: feat Conventional commit type for new features. package: autogram labels Oct 30, 2025
ValerianRey and others added 2 commits November 17, 2025 17:10
# Conflicts:
#	tests/speed/autogram/grad_vs_jac_vs_gram.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: feat Conventional commit type for new features. package: autogram package: sparse

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant