I came across another error while calculating loss with cross entropy .
There error said the following:
RuntimeError: only batches of spatial targets supported (3D tensors) but got targets of dimension: 4 at /b/wheel/pytorch-src/torch/lib/THCUNN/generic/SpatialClassNLLCriterion.cu:14
I wasn’t able to understand what the error meant?
I have a batch size of 5 and and the image size is 256 x 256 x 1 so the output size is (5L, 1L, 256L, 256L) and so is the size of the label.