In that case your output should have the shape [batch_size, nb_classes, num_items], which could be seen as a temporal signal, where each sample contains the class logits for nb_classes.
nn.CrossEntropyLoss would then maximize the output of the current neuron which corresponds to the target class.
Would that be possible using your model?