Skip to content

[ONNX] Replace optional parameters of Resize with placeholder for ops13.#50574

Merged
neginraoof merged 6 commits intopytorch:onnx_ms_1from
fatcat-z:onnx_ops13_resize
Jan 22, 2021
Merged

[ONNX] Replace optional parameters of Resize with placeholder for ops13.#50574
neginraoof merged 6 commits intopytorch:onnx_ms_1from
fatcat-z:onnx_ops13_resize

Conversation

@fatcat-z
Copy link
Copy Markdown
Collaborator

Replace optional parameters of Resize with placeholder for ops13.

Copy link
Copy Markdown
Contributor

@jiafatom jiafatom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reuse the logic from Resize-11 exporter? The onnx spec change only affects the input to optional, code logic seems to be reusable.

@fatcat-z
Copy link
Copy Markdown
Collaborator Author

fatcat-z commented Jan 16, 2021

Can we reuse the logic from Resize-11 exporter? The onnx spec change only affects the input to optional, code logic seems to be reusable.

Yes, the logic is same. Changing the dummy data used in Resize-11 exporter to place holder in Resize-13 is aimed to reduce the final ONNX file size. Place holder will cause an empty for the optional parameter while dummy data will still occupy some room iu the ONNX file.

@jiafatom
Copy link
Copy Markdown
Contributor

Can we reuse the logic from Resize-11 exporter? The onnx spec change only affects the input to optional, code logic seems to be reusable.

Yes, the logic is same. Changing the dummy data used in Resize-11 exporter to place holder in Resize-13 is aimed to reduce the final ONNX file size. Place holder will cause an empty for the optional parameter while dummy data will still occupy some room iu the ONNX file.

Sorry for confusion. My point is that can we reuse the common code to avoid code duplication? Put the common code into symbolic_helper.py, see example as def _squeeze_helper(g, input, axes_i):

@fatcat-z
Copy link
Copy Markdown
Collaborator Author

Can we reuse the logic from Resize-11 exporter? The onnx spec change only affects the input to optional, code logic seems to be reusable.

Yes, the logic is same. Changing the dummy data used in Resize-11 exporter to place holder in Resize-13 is aimed to reduce the final ONNX file size. Place holder will cause an empty for the optional parameter while dummy data will still occupy some room iu the ONNX file.

Sorry for confusion. My point is that can we reuse the common code to avoid code duplication? Put the common code into symbolic_helper.py, see example as def _squeeze_helper(g, input, axes_i):

Got it, yes it makes sense. Working on it.

Copy link
Copy Markdown
Contributor

@neginraoof neginraoof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Left a couple minor comments.

@neginraoof neginraoof merged commit 9145d90 into pytorch:onnx_ms_1 Jan 22, 2021
BowenBao added a commit that referenced this pull request Jan 22, 2021
…13. (#50574)

* Replace optional parameters of Resize with placeholder for ops13.

* Use common methods to handle different versions.

* Correct flake8 issue.

* Update per comments.

* Add something to trigger CI again.

* Trigger another round of CI.

[ghstack-poisoned]
BowenBao added a commit that referenced this pull request Jan 22, 2021
…der for ops13. (#50574)"

* Replace optional parameters of Resize with placeholder for ops13.

* Use common methods to handle different versions.

* Correct flake8 issue.

* Update per comments.

* Add something to trigger CI again.

* Trigger another round of CI.

Differential Revision: [D26023939](https://our.internmc.facebook.com/intern/diff/D26023939)

[ghstack-poisoned]
@fatcat-z fatcat-z deleted the onnx_ops13_resize branch January 23, 2021 07:36
BowenBao added a commit that referenced this pull request Jan 25, 2021
…der for ops13. (#50574)"


* Replace optional parameters of Resize with placeholder for ops13.

* Use common methods to handle different versions.

* Correct flake8 issue.

* Update per comments.

* Add something to trigger CI again.

* Trigger another round of CI.

[ghstack-poisoned]
BowenBao added a commit that referenced this pull request Jan 25, 2021
…der for ops13. (#50574)"


* Replace optional parameters of Resize with placeholder for ops13.

* Use common methods to handle different versions.

* Correct flake8 issue.

* Update per comments.

* Add something to trigger CI again.

* Trigger another round of CI.

Differential Revision: [D26050882](https://our.internmc.facebook.com/intern/diff/D26050882)

[ghstack-poisoned]
BowenBao added a commit that referenced this pull request Jan 26, 2021
…der for ops13. (#50574)"


* Replace optional parameters of Resize with placeholder for ops13.

* Use common methods to handle different versions.

* Correct flake8 issue.

* Update per comments.

* Add something to trigger CI again.

* Trigger another round of CI.

Differential Revision: [D26050882](https://our.internmc.facebook.com/intern/diff/D26050882)

[ghstack-poisoned]
facebook-github-bot pushed a commit that referenced this pull request Jan 28, 2021
…13. (#50574) (#50954)

Summary:
Pull Request resolved: #50954

* Replace optional parameters of Resize with placeholder for ops13.

* Use common methods to handle different versions.

* Correct flake8 issue.

* Update per comments.

* Add something to trigger CI again.

* Trigger another round of CI.

Test Plan: Imported from OSS

Reviewed By: pbelevich

Differential Revision: D26050882

Pulled By: SplitInfinity

fbshipit-source-id: aea6205a1ba4a0621fe1ac9e0c7d94b92b6d8f21
BowenBao added a commit to BowenBao/pytorch that referenced this pull request Jan 28, 2021
…13. (pytorch#50574)

* Replace optional parameters of Resize with placeholder for ops13.

* Use common methods to handle different versions.

* Correct flake8 issue.

* Update per comments.

* Add something to trigger CI again.

* Trigger another round of CI.

ghstack-source-id: e57846f
Pull Request resolved: pytorch#50954
robertknight added a commit to robertknight/rten that referenced this pull request Jan 16, 2023
ONNX models generated from PyTorch targeting ONNX opset < 13 use empty tensors
to represent omitted optional inputs in the Resize operator, rather than setting
the input name to an empty string.

See pytorch/pytorch#50574.
robertknight added a commit to robertknight/rten that referenced this pull request Jan 16, 2023
ONNX models generated from PyTorch targeting ONNX opset < 13 use empty tensors
to represent omitted optional inputs in the Resize operator, rather than setting
the input name to an empty string.

See pytorch/pytorch#50574.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants