The shape of your data is usually defined by the layers, loss functions, etc. you are using.
For CNNs you most likely will use nn.Conv2d layers, which expect the data to have the shape [batch_size, channels, height, width].
The output of your model should match the input of the loss function. For a multi-class classification use case you will most likely use nn.CrossEntropyLoss or nn.NLLLoss, which both expect the prediction to have the shape [batch_size, nb_classes].