Skip to content

feat: add forward_tangents and deferred input_tangents to ReverseRule#6

Merged
shinaoka merged 2 commits intomainfrom
deferred-hvp-tangents
Mar 28, 2026
Merged

feat: add forward_tangents and deferred input_tangents to ReverseRule#6
shinaoka merged 2 commits intomainfrom
deferred-hvp-tangents

Conversation

@shinaoka
Copy link
Copy Markdown
Member

Summary

Add deferred tangent injection support to ReverseRule trait for HVP computation.

  • Add forward_tangents() method with default impl returning Err(HvpNotSupported)
  • Add input_tangents closure parameter to pullback_with_tangents() so rules can read primal tangents at HVP time instead of storing them at construction time

This is a breaking change to pullback_with_tangents — all downstream implementors must update their signature.

Needed by tensor4all/tidu-rs#6 for deferred leaf tangent injection.

Test plan

  • Existing tests updated for new signature
  • New test for forward_tangents default impl

🤖 Generated with Claude Code

Add forward_tangents method to ReverseRule trait for deferred forward
tangent propagation in HVP computation. Update pullback_with_tangents
to accept an input_tangents closure parameter, enabling the AD engine
to inject tangents at call time rather than requiring rules to store
them in their struct fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shinaoka shinaoka enabled auto-merge (squash) March 28, 2026 01:09
@shinaoka shinaoka merged commit 6cc4677 into main Mar 28, 2026
5 checks passed
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