First thing, you probably want your image ot be Bx3x32x32 - we only support batched inputs in CHW data ordering, but I think you meant to use a HWC order. You need to transpose the image.
Secondly, what kind of loss would you like to use exactly? If it’s segmentation then, nn.NLLLoss2d should do it.