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] Enable constant folding for Shape #35386
Conversation
💊 CircleCI build failures summary and remediationsAs of commit 77c327d (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no CircleCI failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker. This comment has been revised 37 times. |
Also, please check the failures. Looks like test test/onnx/test_operators.py TestOperators.test_expand is failing. |
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.
Thanks for the fixes. Please check if there's an onnxruntime test for shape and add that if not.
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 can you merge this PR? |
@KsenijaS could you rebase this PR please? |
@houseroad can you please review my PR, it seems that none of the failure are caused by my changes |
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.
not sure why we need to change onnx::gather part
@@ -295,7 +299,7 @@ c10::optional<at::Tensor> runTorchBackendForOnnx( | |||
inputTensorValues[0], p, node->is(attr::axes), node->i(attr::keepdims)); | |||
return c10::optional<at::Tensor>(updated_val); | |||
} else if (node->kind() == onnx::Gather) { | |||
assert(inputTensorValues.size() == 1); | |||
assert(inputTensorValues.size() == 2); |
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.
why change this?
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.
gather has 2 inputs, that's why my tests were failing
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.
This was a bug in gather implementation for constant folding. This node is required to have 2 inputs always (Note that this assertion as not blocking tests on CI, and was caught locally).
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 if you have no further comments, can this PR be merged?
@houseroad can we merge this PR? |
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, please update assert to TORCH_INTERNAL_ASSERT
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.
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.
Thanks
@houseroad merged this pull request in 4f728c9. |
1 similar comment
@houseroad merged this pull request in 4f728c9. |
Summary: Enabled constant folding for onnx::Shape Pull Request resolved: pytorch#35386 Reviewed By: hl475 Differential Revision: D20682412 Pulled By: houseroad fbshipit-source-id: 4559a35f174edfb7e6364c0fbf5bc1d55d0d26dc
Enabled constant folding for onnx::Shape