- 
                Notifications
    
You must be signed in to change notification settings  - Fork 369
 
Closed
Labels
No ActivitybugSomething isn't workingSomething isn't workingcomponent: convertersIssues re: Specific op convertersIssues re: Specific op converters
Description
Bug Description
This is a regression due to :
- torch 2.0.1
 - torch-tensorrt 1.4.0
 - torchvision 0.15.2
 - tensorrt 8.6.1
 
Now we fail to convert every network with torch_tensorrt.compile() if negative pad is used inside ConstantPad layer while conversion work fine in earlier version
example: torch.nn.ConstantPad2d(-6, float(0.0)) will raised RuntimeError: [Error thrown at core/conversion/converters/impl/constant_pad.cpp:35] Expected left >= 0 to be true but got false Unsupported negative pad at index 0
To Reproduce
Steps to reproduce the behavior:
- instantiate a net with a layer having negative pad
 - convert the net with 
trt_ts_module = torch_tensorrt.compile( model.to(device), inputs=[torch_tensorrt.Input((1, 1, args.image_size, args.image_size))], enabled_precisions={torch.half}, # Run with FP16 enabled_precisions, workspace_size = 1024, ) - get message 
RuntimeError: [Error thrown at core/conversion/converters/impl/constant_pad.cpp:35] Expected left >= 0 to be true but got false Unsupported negative pad at index 0 
full stack trace
Traceback (most recent call last):
  File "/home/username/src/dev/deepWork/pytorch/main_test.py", line 446, in <module>
    trt_ts_module = torch_tensorrt.compile(
  File "/home/username/bin/anaconda3/envs/django/lib/python3.10/site-packages/torch_tensorrt/_compile.py", line 133, in compile
    return torch_tensorrt.ts.compile(
  File "/home/username/bin/anaconda3/envs/django/lib/python3.10/site-packages/torch_tensorrt/ts/_compiler.py", line 139, in compile
    compiled_cpp_mod = _C.compile_graph(module._c, _parse_compile_spec(spec))
RuntimeError: [Error thrown at core/conversion/converters/impl/constant_pad.cpp:35] Expected left >= 0 to be true but got false
Unsupported negative pad at index 0
Expected behavior
Conversion work fine in earlier version:
-torch 1.12.1
-torch-tensorrt 1.2.0
-torchvision 0.13.1
-tensorrt 8.0.3.4
Environment
- Torch-TensorRT Version 1.4.0:
 - PyTorch Version 2.0.1:
 - CPU Architecture: x64_64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
 - OS (e.g., Linux): Ubuntu 20.04
 - How you installed PyTorch : pip inside conda env):
 - Python version: 3.10.6
 - CUDA version: 11.8
 - GPU models and configuration: models on cuda:0 GeForce RTX 2070 Mobile
 - Any other relevant information: Regression bug, no bug in earlier version (torch 1.12.1 torch-tensorrt 1.2.0)
 
Additional context
Pure torchscript conversion with torch.jit.trace work fine for all versions !
Metadata
Metadata
Assignees
Labels
No ActivitybugSomething isn't workingSomething isn't workingcomponent: convertersIssues re: Specific op convertersIssues re: Specific op converters