-
Notifications
You must be signed in to change notification settings - Fork 519
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
[onnx] Fix onnx-to-torch
lowering for flatten shape
#2834
Conversation
The existing `flatten` lowering did not define what the intermediate shape was. This could result in failures to lower further to linalg as the intermediate shape was unknown. Added a shape refinement section.
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.
Did this come up in a downstream test? Would this be caught with #2795 landed?
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.
Just the 2 issues
- axis == rank
- handling dynamic
If axis == rank then the loop never executes meaning we never index into shape. |
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.
The bool dynamic = .
line needs another look
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.
It looks like at DefaultDomainAtoF.cpp:1424 there's a redundant or. Did you mean shape[i]?
Code:
bool dynamic = shape[axis] == Torch::kUnknownSize ||
shape[axis] == Torch::kUnknownSize;
otherwise lgtm
Woops, fixed it up. Just needed to check whether the value is dynamic. |
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 all good to me now
The existing
flatten
lowering did not define what the intermediateshape was. This could result in failures to lower further to linalg as
the intermediate shape was unknown. Added a shape refinement section.