This is what this error message means:

one of the variables needed for gradient computation has been modified by an inplace operation

This means that you did an inplace operation on a Tensor whose original value was required to be able to compute gradients.
You need to remove this inplace operation to be able to compute gradients.

which is output 0 of SigmoidBackward,

The problematic Tensor is the output of Sigmoid.
So you need to find where you do an inplace operation on the output of the sigmoid and replace that with an out of place op. Or .clone() the output of the sigmoid.