title: RuntimeError: Given input size: (10x7x7). Calculated output size: (10x0x0). Output size is too small
body: <p>Trying to train the mnist 28x28x1 images <br/></p>
  
  <p>my model is <br/></p>
  
  <pre><code>   def __init__(self):
          super(CNN_mnist, self).__init__()
          self.conv = nn.Sequential(
              # 3 x 128 x 128
              nn.Conv2d(1, 32, 3, 1, 1),
              nn.BatchNorm2d(32),
              nn.LeakyReLU(0.2),
  
              # 32 x 128 x 128
              nn.Conv2d(32, 64, 3, 1, 1),
              nn.BatchNorm2d(64),
              nn.LeakyReLU(0.2),
  
              # 64 x 128 x 128
              nn.MaxPool2d(2, 2),
  
              # 64 x 64 x 64
              nn.Conv2d(64, 128, 3, 1, 1),
              nn.BatchNorm2d(128),
              nn.LeakyReLU(0.2),
  
              # 128 x 64 x 64
              nn.Conv2d(128, 256, 3, 1, 1),
              nn.BatchNorm2d(256),
              nn.LeakyReLU(0.2),
  
              # 256 x 64 x 64
              nn.MaxPool2d(2, 2),
  
              # 256 x 32 x 32
              nn.Conv2d(256, 10, 3, 1, 1),
              nn.BatchNorm2d(10),
              nn.LeakyReLU(0.2)
          )
          # 256 x 32 x 32
          self.avg_pool = nn.AvgPool2d(32)
          # 256 x 1 x 1
          self.classifier = nn.Linear(10, 10)
  
      def forward(self, x):
          features = self.conv(x)
          flatten = self.avg_pool(features).view(features.size(0), -1)
          output = self.classifier(flatten)
          return output, features
  </code></pre>
  
  <p>and I got following error <br/></p>
  
  <blockquote>
    <p>RuntimeError: Given input size: (10x7x7). Calculated output size:
    (10x0x0). Output size is too small</p>
  </blockquote>
  
  <p>not sure what this error mean and where should I fix it? </p>