Open SeaRecluse opened 5 years ago
Great Nihui.Thank you so much😂 I still don't know how to change it.I just learned the pytorch API doc.
I change the code like this. But It doesn't work.
self.avg_pool = nn.AdaptiveAvgPool2d(1)
def forward(self, x):
x = self.features(x)
b, c, _, _ = x.size()
y = self.avg_pool(x).view(b, c)
x = self.classifier(y)
return x
I use the MobileNetV2 and I want to use your model on mobile devices by NCNN.
I convert the model to onnx.When I want to convert the MobileNetV2.onnx by NCNN.The layer ReduceMea n not supported.But NCNN's contributor tell me if I can replace "nn.AvgPool2d" to "nn.AdaptiveAvgPool2d" before the last conv.I will get a usful model. https://github.com/Tencent/ncnn/issues/1092
But I can't find the "nn.AvgPool2d"?Where I can replace it?Thx.