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 will impact the normal pytorch?

See original GitHub issue

in pytorch, I can do the below code right:

a = torch.ones((4, 3, 13, 13), dtype=torch.uint8)
b = torch.rand((4, 3, 13, 13))

c = b[a]

but if I use torch2trt to convert model, then execute the code. error whill occur: IndexError: too many indices for tensor of dimension 4

Will any one reproduce this error.

Wait for your help~

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:21 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dancingpipicommented, Mar 6, 2020

Hi z13974509906,

Thanks for reaching out! I would like to try and reproduce this issue.

Do you mind sharing the model that you were attempting to convert?

Best, John

I have follow pytorch yolov3 . I use torch2trt convert the backbone. After convert, pytorch became abnormal as I mention: b[a] will cause an indexerror, so I have to change it to b[a.tolist()].

If I don’t convert the backbone by torch2trt, b[a] work properly

1reaction
PressEtoRacecommented, Jul 6, 2020

@dancingpipi @PressEtoRace Did you succeed in optimizing inference time of YOLOv3? if yes, Do you detect all objects well with a good accuracy? because the model I am working on can detect only one object! I’ve had problems like yours. I think this is also caused by the influence of torch2trt on pytorch. My solution is to modify the NMS code in yolov3. You can print the size of the data after each operation in NMS, and you should find the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reduced Precision - torch2trt
Reduced Precision. For certain platforms, reduced precision can result in substantial improvements in throughput, often with little impact on model accuracy ...
Read more >
Accelerating Inference Up to 6x Faster in PyTorch with Torch ...
The average throughput reported by PyTorch and TorchScript JIT would be similar. Inference using Torch-TensorRT. To compile the model with Torch ...
Read more >
Inference Mode — PyTorch master documentation
To work around you can make a clone outside InferenceMode to get a normal ... Both guards affects tensor execution process to skip...
Read more >
Torch-TensorRT v1.4.0dev0+c796d26 documentation - PyTorch
Ahead-of-time compilation of TorchScript / PyTorch JIT for NVIDIA GPUs. Torch-TensorRT is a compiler for PyTorch/TorchScript, targeting NVIDIA GPUs via NVIDIA's ...
Read more >
pytorch expand_as
Expanding along a non-singleton dimension will The easiest way to expand ... To Tensorrt Pytorch We will use torch2trt module to convert torch...
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