Solved by alexis-jacq in post #5 
              
              
                That’s interesting, it’s because of the “+=” operation in the forward methode. 
Apparently, x += y is not equivalent to x = x + y, but call a function that does inplace operation (on x.data). 
This code worked for me: 
class SigmoidBias(nn.Module):
    def __init__(self, output_features=5, bias=True…