fix: unify LINSPACE alpha/beta dtype in the arange converter - #4626
Open
SrivastavaKshitij wants to merge 1 commit into
Open
fix: unify LINSPACE alpha/beta dtype in the arange converter#4626SrivastavaKshitij wants to merge 1 commit into
SrivastavaKshitij wants to merge 1 commit into
Conversation
`arange` resolves a common `value_dtype` for the sequence and passes it to each
`get_trt_tensor` call. `get_trt_tensor` applies that dtype when it constructs a constant,
and returns a value that is already an ITensor unchanged:
elif isinstance(input_val, TRTTensor):
return input_val
So a dynamic `start` keeps the dtype of its incoming ITensor, while a literal `step`
becomes a constant of `value_dtype`. TensorRT asks that the LINSPACE `alpha` (input 1) and
`beta` (input 2) have the same type, and reports:
IFillLayer `alpha` and `beta` must have the same type.
`alpha` is of type Int32 but `beta` is of type Int64.
This change routes every operand through a small helper that casts after
`get_trt_tensor`, so the resolved dtype holds for all of them. `cast_trt_tensor` returns
the tensor unchanged when the dtype already matches, so paths that were already consistent
are unaffected.
The tests cover three cases with a dynamic bound: an int32 `start`, an int64 `start`, and
both bounds dynamic. Of those, only the int64 `start` works today, because the sequence
dtype for integer operands is already int64 and matches. The other two pass with this
change, and the full arange converter suite stays green.
SrivastavaKshitij
force-pushed
the
fix/arange-linspace-alpha-beta-dtype
branch
from
August 28, 2026 02:48
e3eeb41 to
91b21b9
Compare
Author
|
@narendasan @apbose for viz |
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.
Description
Issue #4625 has two parts.
arangeresolves a commonvalue_dtypefor the sequence and passes it to eachget_trt_tensorcall.get_trt_tensorapplies that dtype when it constructs a constant, andreturns a value that is already an ITensor unchanged:
So a dynamic
startkeeps the dtype of its incoming ITensor, while a literalstepbecomes aconstant of
value_dtype. TensorRT asks that the LINSPACEalpha(input 1) andbeta(input 2) have the same type, and reports:
This routes every operand through a small helper that casts after
get_trt_tensor, so theresolved dtype holds for all of them.
cast_trt_tensorreturns the tensor unchanged when thedtype already matches, so paths that were already consistent are unaffected.
Issues
Closes #4625
Type of change
Testing
Three cases with a dynamic bound are covered: an int32
start, an int64start, and bothbounds dynamic. Of those, only the int64
startworks today, because the sequence dtype forinteger operands is already int64 and matches.
Checklist: