refactor(aggregation): Fix typing issue in Weighting#539
Merged
ValerianRey merged 1 commit intomainfrom Jan 29, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
PierreQuinton
approved these changes
Jan 29, 2026
Contributor
PierreQuinton
left a comment
There was a problem hiding this comment.
Good enough for now, but yeah, one day we might make them public though, even if this can be annoying (for isntance the function torch.eye doesn't returns a PSDMatrix, but it should). I think for now, those types are just for us to not screw things up, but the interface should be agnostic to them.
Weighting
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.
Since #522, we don't use type annotations anymore, so a new (user-facing) typing issue that we already had for a long time is now visible: in autogram usage examples, we call
weighting(gramian)wheregramianis aTensor(but not aPSDMatrix), butweighting.__call__expects aPSDMatrix.I changed
weighting.__call__to rather expect aTensor(likeAggregator.__call__expects aTensorand not aMatrix). I thus also made the_Ttype variable bound toTensor.This fixes the issue, but it also doesn't seem to be a very good long-term solution. I don't really like that the user-facing types "lie" to the user. Maybe we could make those types (
MatrixandPSDMatrix) public at some point?