Skip to content

✨[Feature] Automatic casting of Long/Double Tensor constants in FX #2008

@gs-olive

Description

@gs-olive

Context

Certain Torch layers, including torch.nn.Embedding handle inputs, weights, and constant Tensors which are required by Torch to be 64-bit types. This causes issues when attempting to build TRT converters for such engines, since the inputs and constants will then be 64-bit, which is not supported by TRT.

Feature Proposal

When users specify the truncate_long_and_double flag, it should have an effect in both FX and Dynamo. A similar feature was implemented for Dynamo compile in a broader context in PR #1983. For this feature, if the user specifies the truncate_long_and_double flag, we should automatically cast the 64-bit constant tensors (weights, constant indices, etc.) to their 32-bit equivalents for use in TRT.

Metadata

Metadata

Assignees

Labels

No Activitycomponent: dynamoIssues relating to the `torch.compile` or `torch._dynamo.export` pathsfeature requestNew feature or requestfx

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions