Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[JIT][ONNX] Expose dim() on type and use it in ONNX symbolics#15933

Closed
jamesr66a wants to merge 2 commits into
pytorch:masterfrom
jamesr66a:transpose_Fix
Closed

[JIT][ONNX] Expose dim() on type and use it in ONNX symbolics#15933
jamesr66a wants to merge 2 commits into
pytorch:masterfrom
jamesr66a:transpose_Fix

Conversation

@jamesr66a
Copy link
Copy Markdown
Collaborator

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.

@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Jan 10, 2019
@jamesr66a jamesr66a changed the title [JIT][ONNX] Export dim() on type and use it in ONNX symbolics [JIT][ONNX] Expose dim() on type and use it in ONNX symbolics Jan 10, 2019
@houseroad houseroad self-requested a review January 10, 2019 23:09
Copy link
Copy Markdown
Member

@houseroad houseroad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. We should record the recommended way to get the dim of the tensors somewhere (probably at the beginning of the symbolic.py)

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jamesr66a is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@ezyang ezyang added the merged label Jun 25, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants