[ONNX] Squeeze operator should give an error when trying to apply to a dimension with shape > 1#38476
[ONNX] Squeeze operator should give an error when trying to apply to a dimension with shape > 1#38476yaeldekel wants to merge 17 commits intopytorch:masterfrom
Conversation
💊 CI failures summary and remediationsAs of commit a0d1116 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no 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 or post in the (internal) Dr. CI Users group. This comment has been revised 78 times. |
|
You can catch flake8 issues locally using command: flake8 . |
|
@neginraoof when this is ready to land ping and I can land it |
houseroad
left a comment
There was a problem hiding this comment.
Could you rebase to master and make sure all related tests passing?
houseroad
left a comment
There was a problem hiding this comment.
Please make sure all the ci passing:
- Lint / flake8-py3 (pull_request)
- onnx
neginraoof
left a comment
There was a problem hiding this comment.
Thanks! I added a few comments.
facebook-github-bot
left a comment
There was a problem hiding this comment.
@houseroad has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@yaeldekel |
houseroad
left a comment
There was a problem hiding this comment.
Could you reabse to the master and rerun the CI?
There was a problem hiding this comment.
Can we add attributes within the addNode c++ method?
There was a problem hiding this comment.
Can we directly check the self's size instead of inserting IF-else block?
There was a problem hiding this comment.
The size is not always available at export time, so we needed to add an if-else block.
houseroad
left a comment
There was a problem hiding this comment.
Please resolve the conflict.
|
We still have conflict, could you rebase the PR to master? @yaeldekel |
|
Could you please resolve the conflicts? |
… outputs in opset 9
facebook-github-bot
left a comment
There was a problem hiding this comment.
@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 3c5e396. |
|
@yaeldekel Could you please explain the new behavior? Does it now emulate PyTorch behavior in ONNX? Does it now prohibit the squeeze(dim) on non-singleton dim from PyTorch? |
|
So...what's the outcome of this issue? |
…a dimension with shape > 1 (pytorch#38476) Summary: The ONNX spec for the Squeeze operator: > Remove single-dimensional entries from the shape of a tensor. Takes a parameter axes with a list of axes to squeeze. If axes is not provided, all the single dimensions will be removed from the shape. If an axis is selected with shape entry not equal to one, an error is raised. Currently, as explained in issue pytorch#36796, it is possible to export such a model to ONNX, and this results in an exception from ONNX runtime. Fixes pytorch#36796. Pull Request resolved: pytorch#38476 Reviewed By: hl475 Differential Revision: D22158024 Pulled By: houseroad fbshipit-source-id: bed625f3c626eabcbfb2ea83ec2f992963defa19
The ONNX spec for the Squeeze operator:
Currently, as explained in issue #36796, it is possible to export such a model to ONNX, and this results in an exception from ONNX runtime.
Fixes #36796.