8000 Relax constraint on subgraph input/output type and shape by BowenBao · Pull Request #2009 · onnx/onnx · GitHub
[go: up one dir, main page]

Skip to content

Relax constraint on subgraph input/output type and shape #2009

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

Merged
merged 5 commits into from
May 13, 2019

Conversation

BowenBao
Copy link
Contributor
@BowenBao BowenBao commented May 8, 2019

In many cases, it is not obvious to know the shape information of inputs/outputs for the subgraph, especially in models where dynamic shape is involved. This PR relaxes this check for subgraph.

@BowenBao BowenBao requested a review from a team as a code owner May 8, 2019 00:07
Copy link
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.

Seems the graph in the test case is not valid.

@BowenBao
Copy link
Contributor Author

cc @ebarsoum @spandantiwari

Copy link
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.

@houseroad houseroad merged commit 0442d42 into onnx:master May 13, 2019
facebook-github-bot pushed a commit to pytorch/pytorch that referenced this pull request Jun 3, 2019
Summary:
~~This is work in progress due to its dependency on multiple pending PRs.~~

- [x] ONNX: Relax constraint on subgraph input/output type & shape check. onnx/onnx#2009
- [x] PyTorch: Add infra to test_pytorch_onnx_caffe2.py to test ScriptModule models. #20256

This PR should partially resolve #17531. However, ideally we shouldn't need to put cast(and reshape) node to help the conversion for loop condition.

- Added cast node for condition values before entering loop node. The ONNX spec only accepts Bool type, while in PyTorch if the condition value is an output from other node it could potentially have any integral type.
- Tidying up the exported ONNX loop subgraph input type & shape. According to ONNX spec, input "M" is exported as 0-d scalar tensor with type int64. input "Cond" is exported as incomplete tensor of type Bool without shape information. This is because through out the iteration, the rank of condition value is dynamic, either 0-d or 1-d, as long as it holds a single value.
Pull Request resolved: #20445

Differential Revision: D15534188

Pulled By: houseroad

fbshipit-source-id: d174e778529def05ee666afeee4b8fb27786e320
hariharans29 pushed a commit to hariharans29/onnx that referenced this pull request Aug 15, 2019
* Relax constraint on subgraph input/output type and shape

* use is_main_graph in CheckerContext

* create copy of CheckerContext for subgraph

* fix nested_graph test case
@prasanthpul prasanthpul added this to the 1.6 milestone Aug 21, 2019
jcwchen pushed a commit to jcwchen/onnx that referenced this pull request Sep 23, 2020
* Relax constraint on subgraph input/output type and shape

* use is_main_graph in CheckerContext

* create copy of CheckerContext for subgraph

* fix nested_graph test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0