Solved by ptrblck in post #2 
              
              
                dim1 represents the channel dimension. Since MNIST uses grayscale images, the channel dim has a value of 1. 
nn.Conv2d and other 2-dimensional layers expect an input of [batch_size, channels, height, width].