Skip to content

refactor(linalg): Add missing overload to compute_gramian#540

Merged
ValerianRey merged 1 commit intomainfrom
add-compute_gramian-overload
Jan 29, 2026
Merged

refactor(linalg): Add missing overload to compute_gramian#540
ValerianRey merged 1 commit intomainfrom
add-compute_gramian-overload

Conversation

@ValerianRey
Copy link
Copy Markdown
Contributor

I thought we could remove it, but this overload is actually necessary. Otherwise we get a Pylance error when we don't match the other overloads.

@ValerianRey ValerianRey added cc: refactor Conventional commit type for any refactoring, not user-facing, and not typing or perf improvements package: linalg labels Jan 29, 2026
@ValerianRey ValerianRey self-assigned this Jan 29, 2026
@ValerianRey
Copy link
Copy Markdown
Contributor Author

@PierreQuinton FYI (you were right about this in your PR).

@ValerianRey ValerianRey changed the title refactor(linalg): Add missing overload to refactor(linalg): Add missing overload to compute_gramian Jan 29, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/torchjd/_linalg/_gramian.py 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ValerianRey ValerianRey merged commit 6eddc91 into main Jan 29, 2026
14 checks passed
@ValerianRey ValerianRey deleted the add-compute_gramian-overload branch January 29, 2026 17:18
@PierreQuinton
Copy link
Copy Markdown
Contributor

@ValerianRey Any reason why the CI passed on this? I would have expected mypy to be unhappy there. Is there something we can do to make it stricter? Or is it just that mypy doesn't check overloads at all?

@ValerianRey
Copy link
Copy Markdown
Contributor Author

@ValerianRey Any reason why the CI passed on this? I would have expected mypy to be unhappy there. Is there something we can do to make it stricter? Or is it just that mypy doesn't check overloads at all?

The reason is that we don't currently ever use compute_gramian with Tensor and contracted_dims other than the default, -1 or 1, so we never fell into this case.

Also, mypy isn't checked in tests.

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: linalg

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants