Recover Conv/ConvTranspose rank from weight when input shape is unknown#29149
Open
fanchenkong1 wants to merge 1 commit into
Open
Recover Conv/ConvTranspose rank from weight when input shape is unknown#29149fanchenkong1 wants to merge 1 commit into
fanchenkong1 wants to merge 1 commit into
Conversation
The layout transformer skips converting a node to NHWC when input[0] has no inferred shape. But the NCHW<->NHWC permutation depends only on rank. For Conv/ConvTranspose the data input and weight share the same rank, so when input[0]'s rank is unknown, recover it from the weight at input[1].
Contributor
Author
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.
Recover Conv/ConvTranspose rank from weight when input shape is unknown, enabling layout transformation to NHWC for more nodes.
Description
The layout transformer skips converting a node to NHWC when input[0] has no inferred shape.
For Conv and ConvTranspose operators, the data input (input[0]) and the weight (input[1]) always share the same rank. When the input rank is unknown, recover it from the weight.
Performance Impact
Measured on Kokoro-82M-v1.0-ONNX text-to-speech model (onnx-community/Kokoro-82M-v1.0-ONNX) with WebGPU ep,
This change yields a 1.2–1.5× speedup on the Kokoro-82M text-to-speech model.