Repository navigation
[BUG] Move tensors in nested prediction outputs to the requested device - #2468
Open
AHMETHAKANBEZIR1 wants to merge 1 commit into
Open
AHMETHAKANBEZIR1 wants to merge 1 commit into
AHMETHAKANBEZIR1 wants to merge 1 commit into
Conversation
AHMETHAKANBEZIR1
requested review from
benHeid,
fkiraly,
jdb78 and
phoeenniixx
as code owners
October 14, 2026 06:30
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2468 +/- ##
=======================================
Coverage ? 88.83%
=======================================
Files ? 218
Lines ? 11669
Branches ? 0
=======================================
Hits ? 10366
Misses ? 1303
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
LLM generated content, by OpenAI Codex
Reference Issues/PRs
Related to the prediction collection context of #2228, which fixed the v2 callback. This fixes the shared device-moving helper; it does not claim to resolve or measure #772's GPU memory report.
What does this implement/fix? Explain your changes.
move_to_devicediscards the converted children of an immutableOutputMixIn, leaving network-output tensors on their old device. Its sequence path also checks onlyx[0].device: empty sequences raise, nested containers fail, and a later tensor is skipped when the first is already on the target device.Rebuild network outputs with moved fields and recursively traverse every sequence item, retaining list/tuple/namedtuple types. Existing dictionary updates and MPS fallback behavior are unchanged; non-tensor metadata passes through.
What should a reviewer concentrate their feedback on?
Immutable output reconstruction and traversal independent of the first item. CPU-to-meta checks use real PyTorch transfers, so these regressions run without a GPU. They are not measurements of GPU memory usage.
Did you add any tests for the change?
Fourteen cases cover a real linear model's network output, nested dictionaries/sequences, empty list/tuple values, mixed source devices, namedtuple preservation and metadata. Clean main 6d0d18a has 12 failures and 2 passing CPU controls; all fourteen pass with the fix.
git diff --checkpasses.CPU Python 3.12.14 / PyTorch 2.13.0. Full-package, GPU, distributed and performance benchmarks were not run.
Any other comments?
No dependency changes. Prepared autonomously with OpenAI Codex; no independent human review is claimed.
PR checklist