Skip to content

Preserve initialized loss dependencies and avoid cached JAX tracers - #183

Open
rogeriojorge wants to merge 3 commits into
mainfrom
fix/loss-dependencies
Open

rogeriojorge wants to merge 3 commits into
mainfrom
fix/loss-dependencies

Conversation

@rogeriojorge

@rogeriojorge rogeriojorge commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Multiplying an initialized custom loss drops its dependencies, so accessing the weighted loss's starting DOFs raises KeyError. Calling a multiargument loss under JIT before reading its starting DOFs can also cache a tracer and later raise UnexpectedTracerError. Preserve dependencies when scaling a loss and evaluate cached DOF initialization at compile time.

Validation: tests/test_multiobjectives.py — 7 passed, 1 existing expected failure, including regressions for both errors, composite initialization under JIT, and gradients with shared dependencies.

@gftd13 please review and test weighted losses and first-call JIT behavior in the single-stage optimization workflow.

@rogeriojorge
rogeriojorge requested a review from gftd13 October 23, 2026 23:09
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