Solved by ptrblck in post #2 
              
              
                The number of input features to your linear layer is defined by the dimensions of your activation coming from the previous layer. 
In your case the activation would have the shape [batch_size, channels=16, height=5, width=5]. In order to pass this activation to nn.Linear, you are flattening this ten…