Repository navigation
refactor: Remove GradVac alias and hard-coded repr names - #802
Closed
ValerianRey wants to merge 1 commit into
Closed
ValerianRey wants to merge 1 commit into
ValerianRey wants to merge 1 commit into
Conversation
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>
Member
Author
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.
GradVacstored its weighting a second time inself._gradvac_weighting, althoughGramianWeightedAggregatoralready setsself.gramian_weighting(typed asGradVacWeighting), which every other aggregator uses. Since it's annn.Moduleattribute, the alias also registered the submodule under one more name, sostate_dict()held a third copy of_phi_t.GradVac.__repr__andQuadprogProjector.__repr__hard-coded the class name; they now useself.__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
GradVacstate_dictsaved before this change has the extra_gradvac_weighting._phi_tkey, soload_state_dict(strict=True)would reject it. Loading aGradVacstate_dictinto a freshGradVacalready fails on main, because_phi_tstarts asNone.🤖 Generated with Claude Code