I dont understand what you are saying but, I got got my solution.  Actually what i was doing was using sigmoid activation at output and using nn.CrossEntropyLoss didnt worked  but BCELoss worked. Also found that for using nn.CrossEntropyLoss , we have to explicitly use  softmax activation. Is i am right?