IrregSpacedGrid: extra_param_names for user-side runtime scalars#351
Open
hmgaudecker wants to merge 1 commit intofeat/categorical-scalarintfrom
Open
IrregSpacedGrid: extra_param_names for user-side runtime scalars#351hmgaudecker wants to merge 1 commit intofeat/categorical-scalarintfrom
hmgaudecker wants to merge 1 commit intofeat/categorical-scalarintfrom
Conversation
`broadcast_to_template` rejects any `fixed_params` key that no DAG function lists in its signature. That assumption breaks for runtime-supplied grids whose points are computed by user-side code from per-iteration scalars (e.g., a grid upper bound) — pylcm itself never reads those scalars, but they still need to flow through the params machinery instead of being funneled through `simulate(params=...)` where they compete with estimation parameters. This adds an `extra_param_names: tuple[str, ...]` keyword to `IrregSpacedGrid`. When `pass_points_at_runtime=True`, each name in the tuple surfaces as a `ScalarFloat` slot in the action/state's pseudo-function template entry alongside `points`. The user's injection code reads the resolved values from `model.fixed_params` (or per-iteration params) before computing the points; pylcm just threads them through `broadcast_to_template` unchanged. Rejected on fixed-points grids — a baked-in grid has no user-side runtime computation to feed. Closes #348. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
Benchmark comparison (main → HEAD)Comparing
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IrregSpacedGrid(extra_param_names=("foo", "bar"))so scalar params consumed by user-side code that builds the runtime points (e.g., an upper bound that changes per optimizer iteration) can flow throughfixed_params/ per-callparamswithout trippingbroadcast_to_template's unknown-keys check.ScalarFloatslot in the grid's pseudo-function template entry alongsidepoints. Pylcm itself never reads these values — they're carried through so user-side injection code can pick them up viamodel.fixed_params[name](or the resolved internal params) before computing the points.Closes #348. Stacks on #350 (uses the
feat/categorical-scalarintbranch as base).Test plan
pixi run -e tests-cpu tests— 961 passed (4 new tests intest_runtime_params.py).pixi run -e type-checking ty— clean.prek run --all-files— clean.🤖 Generated with Claude Code