mustafa_emre_dos:

Since Batch_size = 10 and class_num = 6, my target size is [10,6,256,256].


If you are using nn.CrossEntropyLoss or nn.NLLLoss, the target shape is wrong, as explained before.



 mustafa_emre_dos:

Yes, I use Resnet architecture, so the output size is [10,2048,256,256].


ResNet would return an output of [batch_size, 1000], so you would have to manipulate it in some way to get this output. What were these modifications?