title: how to fix it ''Given input size: (64x176x64). Calculated output size: (64x1x0). Output size is too small''
body: <p>I am trying to use colab to train a segdecNet  which looks like this,github <a href="https://github.com/mengcius/Surface-Defect-Detection" rel="nofollow noreferrer">https://github.com/mengcius/Surface-Defect-Detection</a></p>
  <pre><code>        # SE layers
          self.fc1 = nn.Conv2d(64, 64//16, kernel_size=1)
          self.fc2 = nn.Conv2d(64//16, 64, kernel_size=1)    
  
          self.layer4 = nn.Sequential(
                              nn.Conv2d(64, 1024, 15, stride=1, padding=7),
                              nn.BatchNorm2d(1024),
                              nn.ReLU(inplace=True)
                          )
  
          self.layer5 = nn.Sequential(
                              nn.Conv2d(1024, 1, 1),
                              nn.ReLU(inplace=True)
                          )
  
  
          if init_weights == True:
              pass
  
      def forward(self, x):
          x1 = self.layer1(x)
          x2 = self.layer2(x1)
          x3 = self.layer3(x2)
  
          # Squeeze
          w = F.avg_pool2d(x3, x3.size(2))
          w = F.relu(self.fc1(w))
          w = torch.sigmoid(self.fc2(w))
          # Excitation
          x3 = x3 * w
  
          x4 = self.layer4(x3)
          x5 = self.layer5(x4)
          # print('x:', x4.shape, x5.shape) 
  
          return {&quot;f&quot;:x4, &quot;seg&quot;:x5}
  </code></pre>
  <p>I get this error:</p>
  <pre><code>Namespace(b1=0.5, b2=0.999, batch_size=2, begin_epoch=0, cuda=True, end_epoch=101, gpu_num=1, img_height=1408, img_width=512, lr=0.0001, need_save=True, need_test=True, save_interval=10, test_interval=10, worker_num=4)
  Traceback (most recent call last):
    File &quot;train_segment.py&quot;, line 140, in &lt;module&gt;
      rst = segment_net(img)
    File &quot;/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py&quot;, line 550, in __call__
      result = self.forward(*input, **kwargs)
    File &quot;/content/models.py&quot;, line 87, in forward
      w = F.avg_pool2d(x3, x3.size(2))
  RuntimeError: Given input size: (64x176x64). Calculated output size: (64x1x0). Output size is too small
  </code></pre>
  <p>I'm guessing I'm making a mistake in my channel size or pooling size but i don't know how to fix it.i did't change the dataset in github,but i got error
  i try to change torch1.2 it work.but i want to know if i did't change torch how can i fix my code</p>