예제 #1
0
 def forward(self, x):
     x = self.features(x)  # 1x1024x7x7
     if not self.training and self.test_time_tool:
         x = F.avg_pool2d(x, kernel_size=7, stride=1)
         x = self.classifier(x)
         x = adaptive_avgmax_pool2d(
             out, pool_type='avgmax')  # something wrong here abt dimension
     else:
         x = adaptive_avgmax_pool2d(x, pool_type='avg')
         x = self.classifier(x)
     return x
 def classifier(self, x):
     x = self._classifier(x)
     if not self.training:
         x = adaptive_avgmax_pool2d(x, pool_type='avgmax')
     return x.view(x.size(0), -1)