-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spec: Clarify Transpose #4611
Comments
Hi @justinchuby,
IIUC, at least from onnx shape inference perspective, they should be both fine case if not giving specified perm.
Shape inference will stop if the given perm is an empty list according to this line. Note that since current ONNX spec does not explicitly disallow these, probably the downstream runtime tools' behavior for these cases might also be undefined (either can work or cannot work).
Currently shape inference does not forbid it, but I think we can add a check for it. Feel free to submit a PR to resolve these ambiguity if you have bandwidth. Thanks! |
If the input is 0d, I would expect perm to be an empty list. Would that be reasonable? |
Makes sense to me if we want to explicitly add the restriction: |
Yes. I would say that the current behavior is a bug/limitation of the shape-inference code. |
I also tried out the ONNX reference implementation. It fails for a scalar (0D) input ... I assume this is a fixable limitation. |
Ask a Question
Question
It is unclear what types of tensors Transpose accepts from the spec. For example, does it accept 1d or 0d tensors as inputs? If so can
perm
be an empty list? Isperm
optional since it has words like "by default"? Does len(perm) need to be rank(input)?Further information
Relevant Area: operators
Is this issue related to a specific model?
No
Notes
The text was updated successfully, but these errors were encountered: