code-of-learn-deep-learning-with-pytorch icon indicating copy to clipboard operation
code-of-learn-deep-learning-with-pytorch copied to clipboard

关于cat vs dog中的维度问题

Open zhangjinchu opened this issue 3 years ago • 0 comments

net.py文件中的这段: vgg = models.vgg19(pretrained=True) self.feature = nn.Sequential(*list(vgg.children())[:-1]) self.feature.add_module('global average', nn.AvgPool2d(9))

前两行代码的输出尺寸是7*7,而第三行平均池化的卷积核是9,运行后会出现这样的错误:Given input size: (512x7x7). Calculated output size: (512x0x0). Output size is too small

我的pytorch版本是1.6,是不是版本的问题?但按理说,Pytorch版本的迭代不会影响VGG这种经典网络的参数啊。这到底是怎么回事呢?

zhangjinchu avatar May 13 '22 11:05 zhangjinchu