The 10 should correspond to the number of classes, i.e. your model would output 10 logits for each sample in the batch of 32 samples.
These shapes should work (if you are really working with 10 classes).
However, the error message points to different shapes in dim1 (5 vs. 8), so there still seem to be a discrepancy between the error and the shapes you’ve posted.