我在导入Logger()和Builder()时出错
我在Jetson AGX Xavier上
我也尝试过python shell。
import tensorflow.contrib.tensorrt as trt
TRT_LOGGER = trt.Logger(trt.Logger.INFO)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow.contrib.tensorrt' has no attribute 'Logger'我也不能导入trt.Builder()。
Python版本为3.6.7
"dpkg -l | grep nvinfer“的输出给出了张量RT版本:
ii libnvinfer-dev 5.0.6-1+cuda10.0 arm64 TensorRT development libraries and headers
ii libnvinfer-samples 5.0.6-1+cuda10.0 all TensorRT samples and documentation
ii libnvinfer5 5.0.6-1+cuda10.0 arm64 TensorRT runtime libraries
ii python-libnvinfer 5.0.6-1+cuda10.0 arm64 Python bindings for TensorRT
ii python-libnvinfer-dev 5.0.6-1+cuda10.0 arm64 Python development package for TensorRT
ii python3-libnvinfer 5.0.6-1+cuda10.0 arm64 Python 3 bindings for TensorRT
ii python3-libnvinfer-dev 5.0.6-1+cuda10.0 arm64 Python 3 development package for TensorRT发布于 2019-07-08 04:32:29
您要导入的import tensorflow.contrib.tensorrt as trt包不是TensorRT,这是将TensorRT集成到TF中的包。此程序包没有您要查找的模块,如Logger或Builder。这个包有它自己的API,这些API用于使用TensorRT优化TF模型。
有关将TensorRT集成到TF的更多链接:
如果你想在TF之外直接使用TensorRT API,你应该像这样导入:import tensorrt as trt。
发布于 2019-07-11 14:41:13
我解决了这个问题。我所做的是:
我已经移除了Tensorflow 1.13并安装了1.12。我删除了所有的虚拟环境。未对Jetpack 4.2及其张量RT版本进行任何更改。
但我仍然找不到问题所在。
谢谢
https://stackoverflow.com/questions/56870558
复制相似问题