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):
        super(SigmoidBias, self).__init__()
        if bias:
            uniform = 0.1*(1-2*torch.rand(output_features))
            self.bias = nn.Parameter(torch.Tensor(output_features))
        else:
            self.register_parameter('bias', None)

    def forward(self, input):
        output = torch.sigmoid(input)
        if self.bias is not None:
            output = output + self.bias.unsqueeze(0).expand_as(output)
        return output