Yes, dim1 can be seen as the channel dimension, which holds the number of classes, if it’s the output of a model for a multi-class segmentation.
The “meaning” of the dimensions is basically defined by the use case and nn.CrossEntropyLoss expects a model output in the shape [batch_size, nb_classes, *].