Skip to content

refactor: Remove GradVac alias and hard-coded repr names - #802

Closed
ValerianRey wants to merge 1 commit into
mainfrom
refactor/gradvac-alias-and-reprs
Closed

ValerianRey wants to merge 1 commit into
mainfrom
refactor/gradvac-alias-and-reprs

Conversation

@ValerianRey

Copy link
Copy Markdown
Member
  • GradVac stored its weighting a second time in self._gradvac_weighting, although GramianWeightedAggregator already sets self.gramian_weighting (typed as GradVacWeighting), which every other aggregator uses. Since it's an nn.Module attribute, the alias also registered the submodule under one more name, so state_dict() held a third copy of _phi_t.
  • GradVac.__repr__ and QuadprogProjector.__repr__ hard-coded the class name; they now use self.__class__.__name__ like the other classes, so subclasses get their own name.

Outputs (same seed, including setters and reset) and the reprs of both classes are unchanged, and the GradVac, dual cone, UPGrad and DualProj tests pass.

Note: a GradVac state_dict saved before this change has the extra _gradvac_weighting._phi_t key, so load_state_dict(strict=True) would reject it. Loading a GradVac state_dict into a fresh GradVac already fails on main, because _phi_t starts as None.

🤖 Generated with Claude Code

GradVac stored its weighting a second time in `_gradvac_weighting`, although
the base class already exposes it as `gramian_weighting`. GradVac.__repr__ and
QuadprogProjector.__repr__ now use `self.__class__.__name__`, like the other
classes, so that subclasses get the right name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ValerianRey ValerianRey added package: aggregation cc: refactor Conventional commit type for any refactoring, not user-facing, and not typing or perf improvements package: linalg labels Oct 7, 2026
@github-actions github-actions Bot changed the title Remove GradVac alias and hard-coded repr names refactor: Remove GradVac alias and hard-coded repr names Oct 7, 2026
@ValerianRey

Copy link
Copy Markdown
Member Author

Superseded by #811 (remove the redundant GradVac weighting alias) and #812 (use the class name in the __repr__ of GradVac and QuadprogProjector), which split this PR in two.

@ValerianRey ValerianRey closed this Oct 7, 2026
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: aggregation package: linalg

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant