Repository navigation
fix(converters): let converters declare uint8 support and reject uint8 tensors otherwise - #4819
Closed
narendasan wants to merge 1 commit into
Closed
narendasan wants to merge 1 commit into
narendasan wants to merge 1 commit into
Conversation
…8 tensors otherwise TensorRT accepts a UInt8 tensor only as a network input or output, and only into an identity, a cast or a shape read. Torch-TensorRT converted other ops on uint8 tensors anyway, so compilation failed outright: a permute, reshape, slice, stack or reduction of a uint8 camera frame stopped with "Could not get tensor shape", and a comparison with a scalar with "Currently supported target_quantized_type for uint8 is FP4". Robot policies that take raw camera frames hit this whenever they rearranged frames before casting them to float. Converters now declare whether they can take a uint8 tensor (supports_uint8, next to supports_dynamic_shapes), and the registry skips a converter that does not when an ATen node reads a uint8 input or produces a uint8 output. The node then runs in PyTorch, and the uint8 tensors it shares with an engine become that engine's inputs and outputs. The converters that cast before anything else reads the input opt in: _to_copy, clone, sym_size, log1p, and add/sub/mul/div, whose validators accept a uint8 operand when the result is floating. Constants and non-ATen operators are not checked, so FP4 weights packed in uint8 still convert. Since the decision lives in the registry, both partitioners and the interpreter see the same answer, and a new converter is safe by default. Co-Authored-By: Claude Opus 5.5 <[email protected]>
narendasan
force-pushed
the
narendasan/uint8-pytorch-fallback
branch
from
October 8, 2026 02:49
2a48fc3 to
dacfd2e
Compare
Collaborator
Author
|
Superseded by #4953: the partitioners now keep any node that would make a uint8 tensor inside the engine in PyTorch ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
supports_uint8ondynamo_tensorrt_converter/ConverterSupport, next tosupports_dynamic_shapes, defaultFalse.ConverterRegistry.__getitem__skips a converter without it when an ATen node reads a uint8 input or produces a uint8 output (node_has_uint8_tensors). The node then runs in PyTorch, and the uint8 tensors it shares with an engine become that engine's inputs and outputs._to_copy,clone,sym_size.int,log1p, andadd/sub/mul/div(.Tensor/.Scalar), whose new validator accepts a uint8 operand only when the result is floating. A uint8 result would need uint8 math.supports uint8._reshape_copy.CONVERTERS.keys()), so it skips this check as it skips every validator.Tests
tests/py/dynamo/conversion/test_uint8_support.py(new):main), and a cast or promotion out of uint8 stays in the engine.tests/py/dynamo/conversion,partitioning,lowering,models/test_dtype_support.py,models/test_export_serde.py, run with-n 6: 2862 passed. Failures:test_arange_export, which fails onmainas well.test_moe_aten.pygrouped-matmul tests, which returned values up to 2.5e38. They have no uint8 tensors, so this change leaves their converter selection unchanged, and they pass when run alone.main, 20 fail to compile there; with this change all 32 compile and match eager, and the ones that already worked still build into the engine.🤖 Generated with Claude Code