Skip to content

🐛 [Bug] Compiling Models with Int-to-Tensor Casted Inputs #2187

Closed
@gs-olive

Description

@gs-olive

Bug Description

When compiling models with 0D tensor inputs, the following error is encountered:

ERROR: [Torch-TensorRT] - 3: [executionContext.cpp::setInputShape::2259] Error Code 3: API Usage Error (Parameter check failed at: runtime/api/executionContext.cpp::setInputShape::2259, condition: engineDims.nbDims == dims.nbDims
)

To Reproduce

        class Multiply(torch.nn.Module):
            def forward(self, x):
                return x * 7

        inputs = [
            torch.tensor(
                3,
            ).cuda().int(),
        ]

Expected behavior

The models should successfully compile.

Environment

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

  • Torch-TensorRT Version (e.g. 1.0.0): 8c62fca
  • PyTorch Version (e.g. 1.0): 2.1.0.dev20230803+cu121

Additional context

Very relevant to diffusion and detectron-style models.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions