Out of place sigmoid function

Hi all,

I am getting the following error:
one of the variables needed for gradient computation has been modified by an inplace operation.

When I used pytorch anamoly detection it showed following error:
File “”, line 36, in mask
temp2 = torch.sigmoid(temp2)

How should I perform out of place operation on sigmoid function??

Thank you

Hi,

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.