Yes you are right my class_num = 5 and number of batches = 1 and the other dimension is number of anchors.
and I did cls_preds.permute(0,2,1) and my shape is now [1, 5, 17451].
Now I am getting an error saying “RuntimeError: Assertion `cur_target >= 0 && cur_target < n_classes’ failed.  at /pytorch/aten/src/THNN/generic/SpatialClassNLLCriterion.c:111” in nn.nll_loss2d.
any help?
Thank you.