-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedOpen to be worked onOpen to be worked on
Description
🐛 Bug
Incorrect use of detach() and cpu() during fixing #4592.
Please reproduce using the BoringModel
You cannot really.
To Reproduce
Use following BoringModel and post here
The fix for #4592 has good intentions but an obvious bug slipped through.
It is easy to understand but hard to test it, so let's rely on common sense:
That is the original code:
if isinstance(output, Result):
output.detach()
if self.move_metrics_to_cpu:
output.cpu()
Expected behavior
And that supposed to be the correct code, obviously:
if isinstance(output, Result):
output = output.detach()
if self.move_metrics_to_cpu:
output = output.cpu()
Environment
Any.
Additional context
I will make a trivial PR for this, I just wanted to create a ticket to actually track the issue.
In theory, the bug is general pattern, but in practice these two lines were the only ones affected in PL.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedOpen to be worked onOpen to be worked on