torch2trt
torch2trt copied to clipboard
AdaptivaAvgPool2d : 'NoneType' object has no attribute 'stride'
Hello, I have a problem. Did the torch2trt support to convert AdaptivaAvgPool2d? I found the source code for convert AdaptiveAvgPool2d, but it doesn't work.
class net(nn.Module): def init(self): super(net, self).init() self.global_aver_polling=nn.AdaptiveAvgPool2d((1,1)) def forward(self,x): out=self.global_aver_polling(x) return out if name == 'main': img = torch.randn(1, 32, 640, 360).cuda() net2 = net().cuda().eval() net2_trt=torch2trt(net2,[img]) with torch.no_grad(): net2_trt(img)
Traceback (most recent call last):
File "test_conv_time.py", line 154, in
I have tested it again, and I found that it has a error:"[TensorRT] ERROR: Parameter check failed at: ../builder/Network.cpp::addPoolingNd::731, condition: allDimsGtEq(windowSize, 1) && volume(windowSize) < MAX_KERNEL_DIMS_PRODUCT "
So, the follow url should be helpful: (The same or similar issue because of the TensorRT version is too low??) https://github.com/onnx/onnx-tensorrt/issues/333
The url gives two solution: 1.use double avgpooling 2.update the TensorRT version to 7.* or newer.
But my TensorRT version is 7.1, so why the issue also happens??
My task is the imgae superresolution, but I now notice that this torch2trt doesn't support dynamic input. please see this link: https://github.com/NVIDIA-AI-IOT/torch2trt/issues/317
And no offense, I will try this repositories : https://github.com/grimoire/torch2trt_dynamic
I have the same problem
I have the same problem. I think it fails when the input size is too big
I have the same problem
I have the same issue
I have the same problem
https://github.com/grimoire/torch2trt_dynamic solves this, thanks @aoaforever