Skip to content

refactor(scalarization): Extract shape check in scalarizers - #801

Merged
ValerianRey merged 4 commits into
mainfrom
refactor/scalarizer-shape-check
Oct 7, 2026
Merged

ValerianRey merged 4 commits into
mainfrom
refactor/scalarizer-shape-check

Conversation

@ValerianRey

@ValerianRey ValerianRey commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

COSMOS (weights), PBI (weights, reference) and STCH (weights, reference) each repeated the same 6-line block checking that the tensor has the shape of values. The 5 copies are replaced by a single check_same_shape_as_values in a new scalarization/_utils.py.

The error messages are unchanged: I compared them before and after for all 5 checks (plus the outputs of valid calls), and the scalarization tests pass.

🤖 Generated with Claude Code

COSMOS, PBI and STCH each repeated the same check that `weights` or
`reference` has the shape of `values`. It is now done by
`check_same_shape_as_values` in `scalarization/_utils.py`. The error messages
are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ValerianRey ValerianRey added cc: refactor Conventional commit type for any refactoring, not user-facing, and not typing or perf improvements package: scalarization labels Oct 7, 2026
@github-actions github-actions Bot changed the title Extract shape check in scalarizers refactor(scalarization): Extract shape check in scalarizers Oct 7, 2026
@ValerianRey
ValerianRey marked this pull request as ready for review October 7, 2026 15:55
@ValerianRey
ValerianRey enabled auto-merge (squash) October 7, 2026 15:55

@ppraneth ppraneth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ValerianRey
ValerianRey merged commit 2de4301 into main Oct 7, 2026
18 checks passed
@ValerianRey
ValerianRey deleted the refactor/scalarizer-shape-check branch October 7, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: refactor Conventional commit type for any refactoring, not user-facing, and not typing or perf improvements package: scalarization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants