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

🐛 [Bug] 0-D Tensor input for TensorRT subgraph is usually on cpu, not cuda #1446

Closed
Njuapp opened this issue Nov 8, 2022 · 0 comments · Fixed by #1416
Closed

🐛 [Bug] 0-D Tensor input for TensorRT subgraph is usually on cpu, not cuda #1446

Njuapp opened this issue Nov 8, 2022 · 0 comments · Fixed by #1416
Labels
bug Something isn't working

Comments

@Njuapp
Copy link
Contributor

Njuapp commented Nov 8, 2022

Bug Description

When encountered aten::Int operations, the graph is usually partitioned, and the TensorRT subgraph may accept a 0-D Tensor as its input. This 0-D Tensor input is usually put on CPU, not cuda, as it is done so on Torchscript/Torch.

To Reproduce

Traceback (most recent call last):
File "reproduce.py", line 39, in
trt_output = trt_model(img_input)
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
RuntimeError: The following operation failed in the TorchScript interpreter.
Traceback of TorchScript (most recent call last):
RuntimeError: [Error thrown at core/runtime/execute_engine.cpp:87] Expected inputs[pyt_idx].is_cuda() to be true but got false
Expected input tensors to have device cuda, found device cpu

Expected behavior

Environment

Build information about Torch-TensorRT can be found by turning on debug messages

  • Torch-TensorRT Version (e.g. 1.0.0):
  • PyTorch Version (e.g. 1.0):
  • CPU Architecture:
  • OS (e.g., Linux):
  • How you installed PyTorch (conda, pip, libtorch, source):
  • Build command you used (if compiling from source):
  • Are you using local sources or building from archives:
  • Python version:
  • CUDA version:
  • GPU models and configuration:
  • Any other relevant information:

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant