Solved by ptrblck in post #2 
              
              
                The in_channels in Pytorch’s nn.Conv2d correspond to the number of channels in your input. 
Based on the input shape, it looks like you have 1 channel and a spatial size of 28x28. 
Your first conv layer expects 28 input channels, which won’t work, so you should change it to 1. 
Also the Dense layers…