This helped me
y_pred.shape,label.shape
(torch.Size([5, 2]), torch.Size([5, 2]))
loss_fn(y_pred,torch.argmax(label, dim=1))
where as
loss_fn = torch.nn.CrossEntropyLoss()
The last layer is as follow
self.dropout = torch.nn.Dropout(0.1)
self.fc1 = torch.nn.Linear(768, 256)
self.fc2 = torch.nn.Linear(256, 2)