Empty tensor from cross entropy loss function

My input to the cross entropy loss function is torch.Size([69856, 21]) and target is torch.Size([69856]) and output is torch.Size([]).
When I mention nn.CrossEntropyLoss(reduce=None) it is giving empty tensor
when I mention nn.CrossEntropyLoss(reduce=False) it gives correct output shape but values are Nan.
Please help me solve this issue.

Hi Zeus!

Could you post a simplified, but complete and runnable script that
illustrates this issue, together with the output of the script?


K. Frank

My predicted scores are full of nan. That’s why it is returning empty tensors.