Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Tensor' object has no attribute '_trt' #325

Open
astekardis opened this issue Jun 2, 2020 · 8 comments
Open

AttributeError: 'Tensor' object has no attribute '_trt' #325

astekardis opened this issue Jun 2, 2020 · 8 comments

Comments

@astekardis
Copy link

astekardis commented Jun 2, 2020

I'm currently trying to use torch2trt on my Jetson Nano. See below for the jetson_release info for this device:

 - NVIDIA Jetson Nano (Developer Kit Version)
   * Jetpack 4.4 DP [L4T 32.4.2]
   * NV Power Mode: MAXN - Type: 0
   * jetson_clocks service: inactive
 - Libraries:
   * CUDA: 10.2.89
   * cuDNN: 8.0.0.145
   * TensorRT: 7.1.0.16
   * Visionworks: 1.6.0.501
   * OpenCV: 4.1.1 compiled CUDA: NO
   * VPI: 0.2.0
   * Vulkan: 1.2.70

Note that I've confirmed that the sample usage code given here runs without issue on this device.

I've cloned torch2trt and installed it with plugin support on my Nano, but am unable to successfully to convert my object detection pytorch model to a TensorRT engine. Specifically, the error that returns when I call model_trt = torch2trt(model, [x]) is as follows:

Traceback (most recent call last):
  File "test.py", line 9, in <module>
    model_trt = torch2trt(retinanet, [x])
  File "/usr/local/lib/python3.6/dist-packages/torch2trt/torch2trt.py", line 377, in torch2trt
    outputs = module(*inputs)
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/nvidia/projects/object_detection/retinanet/model.py", line 259, in forward
    transformed_anchors = self.regressBoxes(anchors, regression)
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/nvidia/projects/object_detection/retinanet/utils.py", line 104, in forward
    widths  = boxes[:, :, 2] - boxes[:, :, 0]
  File "/usr/local/lib/python3.6/dist-packages/torch2trt/torch2trt.py", line 202, in wrapper
    converter['converter'](ctx)
  File "/usr/local/lib/python3.6/dist-packages/torch2trt/converters/getitem.py", line 31, in convert_tensor_getitem
    input_trt = input._trt
AttributeError: 'Tensor' object has no attribute '_trt'

Since the error appears to be with the getitem converter, I tried running python3 -m torch2trt.test --name=getitme from the top level torch2trt directory, but no output is printed.

What can I do to solve this issue?

@yuzhiyiliu
Copy link

I encountered the same problem.
Any solution?

@Joevaen
Copy link

Joevaen commented Aug 10, 2020

I encountered the same problem.
Any solution?

Same problem with yours, solved?

@austinmw
Copy link

Any updates on this?

@DWendou
Copy link

DWendou commented Jun 22, 2021

same problem,who can solve it?@jaybdub

@mlizhardy
Copy link

same here

@DuyguSerbes
Copy link

Same problem, how did you able to solve it?

@yingzgigi
Copy link

same error, any updates?

@wyf-1996
Copy link

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants