Conversation
… in Polygraphy TensorRT's ONNX parser rejects Slice ops whose starts/ends/axes/steps have inconsistent lengths with a low-level assertion (e.g. "Assertion failed: (starts.size() == axes.size())"). NetworkFromOnnx and NetworkFromOnnxPath now validate Slice input lengths up front and raise an actionable error naming the offending node. Adds check_onnx_slice_input_lengths in backend/trt/util.py, wires it into both ONNX import loaders, and adds CPU-runnable regression tests. Signed-off-by: njh1205 <1979582049@qq.com>
Collaborator
|
Let's fix it in the ONNX parser: https://github.com/onnx/onnx-tensorrt/blob/11.3-GA/onnxOpImporters.cpp#L6406. I think the fix would be to change: axes = nbInputs > 3 && !inputs.at(3).isNullTensor() ? ShapeTensor(ctx, inputs.at(3))
: iotaShapeVector(dims.size());to: axes = nbInputs > 3 && !inputs.at(3).isNullTensor() ? ShapeTensor(ctx, inputs.at(3))
: iotaShapeVector(starts.size());(which is already the behavior of the else branch). |
This was referenced Sep 29, 2026
Author
|
Parser-level fix now in place: onnx/onnx-tensorrt#1064 (11.3-GA) and #1065 (8.5-GA). See those PRs for the one-line parser fix and the regression test; closing this Polygraphy pre-check workaround in favor of the parser fix. |
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
TensorRT's ONNX parser rejects Slice ops whose starts/ends/axes/steps have inconsistent lengths with a low-level assertion (e.g. "Assertion failed: (starts.size() == axes.size())", see #4470), which is hard to diagnose. Since the TRT ONNX parser source is closed in the OSS release, this fix lands at the Polygraphy tooling layer: NetworkFromOnnx / NetworkFromOnnxPath now validate Slice input lengths before invoking the parser and raise a clear, actionable error naming the offending node.
Changes
Validation
Fixes #4470 (tooling-layer solution; the parser itself is closed-source).