Solved by Bjorn_Lindqvist in post #2 
              
              
                That looks incorrect. The easiest way to solve it is to reshape your output and target to tensors to (bs * n, c) and (bs *n) where bs is the batch size, n the same as your n and c the number of classes: 
labels = labels.reshape(-1)
outputs = outputs.reshape(outputs.shape[0] * outputs.shape[1], -1)

T…