From the [https://pytorch.org/docs/stable/nn.html#torch.nn.CrossEntropyLoss 8](http://CE doc) I learned that I must input “raw, unnormalized scores for each class” (i.e. no softmax in advance).
The shape of the input is input = (N,C,d1​,d2​,…,dK​), where N = batch size, C is number of classes and d1 and d2 are the two dimensions because I work in grey scale, while the target is target = (N,d1,d2).
Also to my understanding I dont have to one-hot encode the target tensors, but I can give them straight away as 256x256 tensors with pixels with values either 0 or 1 denoting the classes.
My network outputs tensors of size: [1, 2, 256, 256]. This seems to be in order as my batch size should be 1, I have C = 2 classes and my input images have dimensions d1 = d2 = 256.
This is then given as input to the CrossEntropyLoss() with the target that has dimensions [1, 256, 256].
I feel like I am approaching something, but the problem just changed from a steadily increasing loss to a loss equal to zero on each epoch.
Ideas to what I do wrong would still be really appreciated.
Thanks,
Simon