[JIT][ONNX] Expose dim() on type and use it in ONNX symbolics#15933
Closed
jamesr66a wants to merge 2 commits into
Closed
[JIT][ONNX] Expose dim() on type and use it in ONNX symbolics#15933jamesr66a wants to merge 2 commits into
jamesr66a wants to merge 2 commits into
Conversation
houseroad
approved these changes
Jan 11, 2019
Member
houseroad
left a comment
There was a problem hiding this comment.
Looks good. We should record the recommended way to get the dim of the tensors somewhere (probably at the beginning of the symbolic.py)
Contributor
facebook-github-bot
left a comment
There was a problem hiding this comment.
@jamesr66a is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
laurentdupin
pushed a commit
to laurentdupin/pytorch
that referenced
this pull request
Apr 24, 2026
Summary: While integrating fork/join into production translation, we found that trying to export `transpose()` where the input is of `TensorType` (rather than `CompleteTensorType`) failed. This is not ideal, since `TensorType` still contains the number of dimensions of the tensor, and that's all the `transpose` symbolic needs. This PR introduces a pybind binding for `dim()` on `TensorType` (and `CompleteTensorType` by inheritance). We now use this in places where it logically makes sense in the symbolics: those symbolics which only require knowledge of the number of dimensions rather than concrete sizes. Pull Request resolved: pytorch#15933 Differential Revision: D13639657 Pulled By: jamesr66a fbshipit-source-id: 6e50e407e93060085fd00a686a928764d0ec888d
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.
While integrating fork/join into production translation, we found that trying to export
transpose()where the input is ofTensorType(rather thanCompleteTensorType) failed. This is not ideal, sinceTensorTypestill contains the number of dimensions of the tensor, and that's all thetransposesymbolic needs.This PR introduces a pybind binding for
dim()onTensorType(andCompleteTensorTypeby inheritance). We now use this in places where it logically makes sense in the symbolics: those symbolics which only require knowledge of the number of dimensions rather than concrete sizes.