Hi Atharva!



 Atharva_Dubey:

the Sigmoid outputs only negative value irrespective of the class.
…
    def forward(self, X):
        lstm_out, self.hidden = self.lstm(X, self.hidden)
        out = lstm_out.contiguous().view(1, -1)
        out = self.linear(out)
        return out
...
        if self.loss == 'BCE':
            self.criterion = net.BCEWithLogitsLoss().cuda()



First, I don’t see a sigmoid() anywhere in the code you posted.
(I suppose that there could be one hiding in the superclass.)
Next, your model outputs the result of a Linear layer, which, in
general, can produce negative values.
Last, your use of BCEWithLogitsLoss suggests that you are not
expecting positive probabilities produced by sigmoid(), but rather
unbounded (including negative) logits (“raw scores”) produced by
Linear.
If this doesn’t clear things up, please explain in more detail why you
are expecting your outputs to be positive.
Good luck!
K. Frank