I tried to write my custom layer for sigmoid. But it doesn’t work. The network is not trained. If I replace the activation function with the standard torch.nn.Sigmoid() then it starts learning and achieves great accuracy. I can’t figure out what’s wrong with my custom sigmoid  Help me please, guys! Thanks
Sigmoid custom module:
class SigmoidCustom(torch.nn.Module):
    def __init__(self):
        super(SigmoidCustom, self).__init__()
    
    def forward(self, x):
        return 1. / (1 + torch.exp(-x))

Network:
class LinearNet(torch.nn.Module):
    def __init__(self, in_features,  out_features, hid_neurons=200):
        super(LinearNet, self).__init__()
        self.lin1 = LinearCustom(in_features, hid_neurons, bias=True)
        self.act1 = SigmoidCustom()
        self.lin2 = LinearCustom(hid_neurons, hid_neurons, bias=True)
        self.act2 = SigmoidCustom()
        self.lin3 = LinearCustom(hid_neurons, out_features, bias=True)
        self.softmax = torch.nn.Softmax(dim=1)
    
    def forward(self, x):
        # x - bs x in_feat
        x = self.lin1(x) # bs x hid_neurons
        x = self.act1(x) # bs x hid_neurons
        x = self.lin2(x) # bs x hid_neurons
        x = self.act2(x) # bs x hid_neurons
        x = self.lin3(x) # bs x out_feat
        return x

    def inference(self, x):
        x = self.softmax(x)
        return x