-
Notifications
You must be signed in to change notification settings - Fork 384
Open
Labels
Blocked [PyTorch]Issue is blocked by some limitation of PyTorchIssue is blocked by some limitation of PyTorchbugSomething isn't workingSomething isn't working
Description
Bug Description
torch_tensorrt.compile will failed if setting opt-shape same as min-shape
To Reproduce
Steps to reproduce the behavior:
- set opt-shape same as min-shape as below
model_compiled = torch_tensorrt.compile(
model,
inputs=[
torch_tensorrt.Input(
min_shape=[1, 3, 256, 256],
opt_shape=[1, 3, 256, 256],
max_shape=[128, 3, 256, 256],
dtype=input.dtype
)
],
)- compile failed:
`
File "/usr/local/lib/python3.12/site-packages/torch/export/exported_program.py", line 124, in wrapper
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/torch/export/_trace.py", line 2071, in _export_for_training
export_artifact = export_func(
^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/torch/export/_trace.py", line 2002, in _non_strict_export
aten_export_artifact = _to_aten_func( # type: ignore[operator]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/torch/export/_trace.py", line 1823, in _export_to_aten_ir_make_fx
raise UserError(UserErrorType.CONSTRAINT_VIOLATION, str(e)) # noqa: B904
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
torch._dynamo.exc.UserError: Constraints violated (_0)! For more information, run with TORCH_LOGS="+dynamic".
- You marked _0 as dynamic but your code specialized it to be a constant (1). If you're using mark_dynamic, either remove it or use maybe_mark_dynamic. If you're using Dim.DYNAMIC, replace it with either Dim.STATIC or Dim.AUTO.
Suggested fixes:
_0 = 1
The error above occurred when calling torch.export.export. If you would like to view some more information about this error, and get a list of all other errors that may occur in your export call, you can replace yourexport()call withdraft_export().
`
Expected behavior
Compile success
Environment
Build information about Torch-TensorRT can be found by turning on debug messages
- Torch-TensorRT Version (e.g. 1.0.0): 2.10.0
- PyTorch Version (e.g. 1.0): 2.9.0
- CPU Architecture: x86_64
- OS (e.g., Linux): Linux
- Python version: 3.12
- CUDA version: 12.9
- GPU models and configuration: H20
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Blocked [PyTorch]Issue is blocked by some limitation of PyTorchIssue is blocked by some limitation of PyTorchbugSomething isn't workingSomething isn't working