NVIDIA-AI-IOT / torch2trt

An easy to use PyTorch to TensorRT converter
MIT License
4.6k stars 675 forks source link

Warning: Encountered known unsupported method torch.nn.functional.interpolate #277

Closed czs1886 closed 4 years ago

czs1886 commented 4 years ago

I tested the interpolate plugin by "python3 -m torch2trt.test --name=interpolate" and no error occured. But when I run my tensorRT program this warning occures. Is it installed correctly?

hua1024 commented 4 years ago

I tested the interpolate plugin by "python3 -m torch2trt.test --name=interpolate" and no error occured. But when I run my tensorRT program this warning occures. Is it installed correctly?

I see the same problem , can you solve it

czs1886 commented 4 years ago

I tested the interpolate plugin by "python3 -m torch2trt.test --name=interpolate" and no error occured. But when I run my tensorRT program this warning occures. Is it installed correctly?

I see the same problem , can you solve it

I solved this. You can modify the try and catch block in torch2trt/torch2trt/init.py and torch2trt/torch2trt/converters/init.py to see the problem.

For me, the direct cause is undefined symbol for libtorch2trt.so. ldd -r libtorch2trt.so to check if you have any undefined symbols. The root cause is I used different versions of gcc to compile protobuff and torch2trt. When I use gcc 4.8.5 to compile it , it works. Below is part of my build.py, I changed some variables.

NJA_TEMPLATE = Template(( "rule link\n" " command = g++ -shared -o $$out $$in -L/usr/lib -L$torch_dir/lib -L$cuda_dir/lib64 -L$trt_lib_dir -lc10 -lc10_cuda -ltorch -lcudart -lprotobuf -lprotobuf-lite -pthread -lpthread -lnvinfer\n" "rule protoc\n" " command = protoc $$in --cpp_out=. --python_out=.\n" "rule cxx\n" " command = g++ -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -c -fPIC $$in -I$cuda_dir/include -I$torch_dir/include -I$torch_dir/include/torch/csrc/api/include -I. -std=c++11 -I$trt_inc_dir\n" ))