-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[ONNX] Export traced aten::unbind #27247
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
Conversation
|
cc @lara-hdr @neginraoof @spandantiwari for review |
lara-hdr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Don't we need operator tests for expected model? |
facebook-github-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@houseroad has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
I think end to end test is good enough for this case. |
houseroad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
|
@pytorchbot rebase this please |
facebook-github-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@houseroad has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@houseroad merged this pull request in ba79233. |
Summary:
This PR enables exporting aten::unbind created by the tracer. The traced version IR will always have this pattern ```aten::unbind -> prim::ListUnpack```.
Another PR supporting scripted aten::unbind will be submitted separately later.
```
// Unbind is being converted to ONNX as Split + Squeeze.
// Example IR
// graph(%0 : Float(3, 4, 5)):
// %7 : Long() = prim::Constant[value={0}]()
// %3 : Tensor[] = aten::unbind(%0, %7)
// %4 : Float(4, 5), %5 : Float(4, 5), %6 : Float(4, 5) = prim::ListUnpack(%3)
// return (%4, %5, %6)
//
// Translates to ONNX:
// graph(%0 : Float(3, 4, 5)):
// %1 : Tensor, %2 : Tensor, %3 : Tensor = onnx::Split[axis=0](%0)
// %4 : Float(4, 5) = onnx::Squeeze[axes=[0]](%3)
// %5 : Float(4, 5) = onnx::Squeeze[axes=[0]](%2)
// %6 : Float(4, 5) = onnx::Squeeze[axes=[0]](%1)
// return (%6, %5, %4)
```
Pull Request resolved: pytorch#27247
Reviewed By: hl475
Differential Revision: D17791095
Pulled By: houseroad
fbshipit-source-id: 83b724275124dd1dedb272583a2fefbdf7035d4c
This PR enables exporting aten::unbind created by the tracer. The traced version IR will always have this pattern
aten::unbind -> prim::ListUnpack.Another PR supporting scripted aten::unbind will be submitted separately later.