torch2trt_dynamic: No warnings, but [TensorRT] ERROR: INVALID_ARGUMENT: Cannot find binding of given name: input_0
I run into [TensorRT] ERROR: INVALID_ARGUMENT: Cannot find binding of given name: input_0 error a few times before, but usually there are some warnings indicate that some methods are not supported. But this time is pretty different.
The TRTModule is successfully built without any warning, but the engine cannot find tensor by
engine.get_binding_index(input_name) torch2trt_dynamic.py line 450.
What’s more, when I use pdb to debug line by line, I find sometimes the TRTModule could be built successfully, but sometimes errors like “‘Tensor’ object has no attribute ‘_trt’” occurs.
To be honest, this drives me crazy now, I’d rather see some warning and write the corresponding unsupported methods by myself…
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (5 by maintainers)
Actually, Nope, like most
tracing baseddeploy tools, this project does not support python control flow statements such asiforwhileetc. That means even you can converttorch.Tensor.__bool__, theifstatement still won’t work. Try:to avoid control flow.
Thanks for your reply! I’ve fixed all the bugs in my code. I’d like to summarize two points:
from torch2trt_dynamic import torch2trt_dynamicin your python code, you will not see the Traceback, you will only see one line:segmentation fault (core dumped). This bothered me so much during the debug process. I will give my GRU converter here:Jetson Nano, Pytorch 1.8.0, TensorRT 7.1.3.0 Thanks to https://github.com/NVIDIA-AI-IOT/torch2trt/issues/144#issuecomment-553321172