RuntimeError: Expected 4-dimensional input for 4-dimensional weight [1024, 64, 3, 3], but got input of size [32, 10] instead

前端 未结 1 1814
隐瞒了意图╮
隐瞒了意图╮ 2021-01-27 18:39

This line works fine

self.conv = nn.Conv2d(3, 64, kernel_size=3, stride=2, padding=1, bias=False)

I introduced ResNet18

self.conv          


        
相关标签:
1条回答
  • 2021-01-27 19:34

    The problem is that resnet18 (and most other classification netwroks) are not fully convolutional networks. The last layer of the net is actually a nn.Linear layer and therefore you cannot simply replace a convolutional block/layer with a resnet.

    0 讨论(0)
提交回复
热议问题