Skip to content

Make PyTorch's forward mode ready without its TorchScript warning - #34

Merged
mcencini merged 1 commit into
mainfrom
quiet-forward-mode
Oct 8, 2026
Merged

mcencini merged 1 commit into
mainfrom
quiet-forward-mode

Conversation

@mcencini

@mcencini mcencini commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

PyTorch's forward mode imports torch._decomp.decompositions_for_jvp at its first dual tensor, and that module scripts its decompositions with torch.jit.script, which warns that it is deprecated. It is PyTorch's own call, done once per process, building TorchScript graphs and no machine code, so nothing on the target needs a toolchain.

blochsim's forward-mode derivatives -- SignalModel.jacobian and the recon operator's A_jvp -- now load those decompositions first, under the switch PyTorch reads for them (PYTORCH_JIT, __debug__), with that one warning filtered for the load. A simulation and its reverse-mode gradients do not load them at all (#33).

Verified: the full suite passes (1614, 3 skipped); the forward-mode tests -- Jacobians, functionals, design, forward-over-reverse, recon -- pass with -W error:torch.jit.script:DeprecationWarning.

🤖 Generated with Claude Code

PyTorch's forward mode registers its decompositions through torch.jit.script
at its first dual tensor, which warns that torch.jit.script is deprecated. A
Jacobian and the linearised operator now load those decompositions first,
under the switch PyTorch reads for them, with that warning silenced for the
load alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mcencini
mcencini merged commit 8d46722 into main Oct 8, 2026
21 checks passed
@mcencini
mcencini deleted the quiet-forward-mode branch October 8, 2026 05:37
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.

1 participant