question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Torch2trt broken for latest L4T 32.4.3 release? Seeing "add_constant incompatible" errors.

See original GitHub issue

Hi,

I upgraded L4T versions from 32.2.1 to the latest release 32.4.3, which has me upgrading from PyTorch 1.3 to PyTorch 1.6.0 and TensorRT 6 to TensorRT 7.1.3. I believe I also upgraded from CUDA 10.0 to CUDA 10.2.

It looks like torch2trt is now broken. After upgrading, I’m now receiving this warning:

WARNING: Unsupported numpy data type. Cannot implicitly convert to tensorrt.Weights.

Followed by this error:

TypeError: add_constant(): incompatible function arguments. The following argument types are supported:
    1. (self: tensorrt.tensorrt.INetworkDefinition, shape: tensorrt.tensorrt.Dims, weights: tensorrt.tensorrt.Weights) -> tensorrt.tensorrt.IConstantLayer

Invoked with: <tensorrt.tensorrt.INetworkDefinition object at 0x7f1c56e1b8>, (), array(17287)

As per issue #313, I tried the fix in this comment. The issue disappears but the problem then arises in other areas of the code.

This same conversion using the same PyTorch model works in L4T 32.2.1 (PyTorch 1.3 and TensorRT 6).

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:7

github_iconTop GitHub Comments

1reaction
yuzhiyiliucommented, Aug 3, 2020

You can convert your pytorch YOLO model before the three YOLO layers, because this series of problems come from them.

0reactions
yqchaucommented, Aug 12, 2022

try

model.eval().cuda() instead of model.cuda()

Read more comments on GitHub >

github_iconTop Results From Across the Web

NVIDIA DeepStream SDK Developer Guide : Quick Start Guide
Follow the directory's README file to run the application. Note: If the application encounters errors and cannot create Gst elements, remove the GStreamer...
Read more >
Jetson tx2 issues and how to fix | GitAnswer
New post in Jetson tx2 tag. Checkout the issues related to ... Torch2trt broken for latest L4T 32.4.3 release? Seeing "add_constant incompatible" errors....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found