8000 Fix type of `_check_losses_are_scalar` by ValerianRey · Pull Request #366 · TorchJD/torchjd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix type of _check_losses_are_scalar #366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2025

Conversation

ValerianRey
Copy link
Contributor

It seems that the type of the losses parameter of _check_losses_are_scalar was wrong. The reason is that the losses parameter that we're supposed to provide it with is an OrderedSet[Tensor], which is not a Sequence. Also, we only iterate over these losses, so I think the desired type is Iterable[Tensor]. This is also consistent with the parameter types of _check_no_overlap.

This fixes the issue reported by mypy.

Copy link
codecov bot commented May 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

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

@ValerianRey ValerianRey mentioned this pull request May 29, 2025
@ValerianRey ValerianRey changed the title Fix type of _check_losses_are_scalar Fix type of _check_losses_are_scalar May 29, 2025
@ValerianRey ValerianRey mentioned this pull request May 29, 2025
1 task
@ValerianRey ValerianRey requested review from PierreQuinton and removed request for PierreQuinton May 29, 2025 19:19
@ValerianRey ValerianRey merged commit b381581 into main Jun 2, 2025
16 checks passed
@ValerianRey ValerianRey deleted the fix-check-losses-are-scalar-type branch June 2, 2025 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0