Hi Mainul!



 Mainul:


Lets say, I only care about one class, If my model gives one output (using sigmoid) rather than two (using softmax), will it be a better idea. If so, could you please explain the reason?



It will be better to use a single output for a binary-classification
problem, rather than two (which you could logically do).  By
doing so you eliminate one redundancy, and the parameters
that go along with it, from your network.  This will provide at
least a modest advantage.



For one output, what loss function should I use? It seems that the PyTorch implementation of cross-entropy is not suitable for this.



The natural loss function to use would be BCEWithLogitsLoss 23
without passing your output through a sigmoid().  If you insist,
for whatever reason, on using a sigmoid(), you would use
BCELoss 10.
Good luck.
K. Frank