1

I am getting error in importing Logger() and Builder()

I am on Jetson AGX Xavier.

I have tried on python shell also.

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'

I can NOT import trt.Builder() also.

Python version is 3.6.7

Output of "dpkg -l | grep nvinfer" which gives Tensor RT version :

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

3 Answers 3

1

The package you are importing import tensorflow.contrib.tensorrt as trt is not TensorRT, this is the package that integrates TensorRT into TF. This package doesn't have the modules you are looking for such as Logger or Builder. This package has its own APIs which are used to optimize a TF models using TensorRT.

More links for the integration of TensorRT into TF:

If you are looking for using TensorRT API directly outside of TF, you should import it like this: import tensorrt as trt.

Sign up to request clarification or add additional context in comments.

1 Comment

Hello I have tried following on python shell. import tensorrt as trt TRT_LOGGER = trt.Logger(trt.Logger.INFO) But still it throws same error. AttributeError: module 'tensorrt' has no attribute 'Logger'"
0

I solved the problem. What I have done is:

I have removed Tensorflow 1.13 and installed 1.12. I deleted all the virtual environment. Made No changes to Jetpack 4.2 and its Tensor RT versions.

But still I could not find what was the issue.

Thanks

Comments

0

I solved the problem by doing:

However, i was importing Tensorrt and not Tensorflow:

pip install nvidia-pyindex
pip install nvidia-tensorrt

2 Comments

any solution for this?: i can only install nvidia-pyindex... nvidia-tensorrt gives errors: The package you are trying to install is only a placeholder project on PyPI.org repository. This package is hosted on NVIDIA Python Package Index.
any solution for this? i could only install pyindex not the nvidia-tensorrt, this is the error: The package you are trying to install is only a placeholder project on PyPI.org repository. This package is hosted on NVIDIA Python Package Index.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.