Skip to content

Dual operator sugar (+ - * /) for forward-mode AD - #196

Merged
godofecht merged 2 commits into
mainfrom
feat/pattern-adoption-p2b
Aug 5, 2026
Merged

godofecht merged 2 commits into
mainfrom
feat/pattern-adoption-p2b

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Summary

  • Dual +, -, *, /, and unary - lower to add/sub/mul/div/neg overloads ([roadmap] Dual + Tensor operators + mutable params #161 partial)
  • Overload resolver promotes Dual ahead of f32 so mixed expressions stay Dual
  • Tourist demos: examples/ml/autodiff/dual_ops.flow, updated autodiff_clean_syntax.flow

Mutable nn.flow param updates remain open on #161.

Test plan

  • pytest tests/unit/test_dual_ops.py
  • python3 -m flow.transpiler examples/ml/autodiff/dual_ops.flow --c --lenient

Made with Cursor

godofecht and others added 2 commits August 5, 2026 14:19
Rewrite Dual + - * / and unary - to existing overload helpers in the C
generator, teach the typechecker/overload resolver Dual promotion, and
ship dual_ops plus a cleaned autodiff demo.

Co-authored-by: Cursor <[email protected]>
@godofecht
godofecht merged commit 3be6dd8 into main Aug 5, 2026
13 checks passed
@godofecht
godofecht deleted the feat/pattern-adoption-p2b branch August 5, 2026 13:22
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