This is already out of place.
This stack shows you the function that needs the value of its output. But that output was modified inplace.
So you need to look for the lines below where temp2 is modified inplace, and make sure it is not anymore.
If you’re not sure, a simple fix is to replace this line with: temp2 = torch.sigmoid(temp2).clone() so that temp2 does not point to the output of the sigmoid anymore but a fresh Tensor.