arkajit_bhattacharya:

i.e., my target is to train a model to get only one class(example: cat)


I assume you are still dealing with two classes, i.e. cat vs. not-cat?
If you are dealing with a single class, you cannot learn anything.
On the other hand, for a binary classification (cat vs. not-cat), you could use nn.BCEWithLogitsLoss.