Skip to content

add GroupNormalization-18#4621

Merged
gramalingam merged 18 commits intoonnx:mainfrom
yuanyao-nv:dev-groupnorm
Nov 4, 2022
Merged

add GroupNormalization-18#4621
gramalingam merged 18 commits intoonnx:mainfrom
yuanyao-nv:dev-groupnorm

Conversation

@yuanyao-nv
Copy link
Copy Markdown
Contributor

@yuanyao-nv yuanyao-nv commented Oct 25, 2022

Signed-off-by: Yuan Yao yuanyao@nvidia.com

Description

Add new function op GroupNormalization to opset 18.

Motivation and Context

Group norm is a commonly used normalization op, similar to some of the existing ONNX ops such as BatchNormalization, InstanceNormalization, and LayerNormalization.

Original paper that introduced the op: https://arxiv.org/abs/1803.08494

Related issue: #2020

Implementations in other frameworks:
https://www.tensorflow.org/addons/api_docs/python/tfa/layers/GroupNormalization
https://pytorch.org/docs/stable/generated/torch.nn.GroupNorm.html

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
@yuanyao-nv yuanyao-nv requested review from a team as code owners October 25, 2022 22:12
Comment thread onnx/backend/test/case/node/groupnorm.py Fixed
Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
@gramalingam gramalingam added the topic: operator Issues related to ONNX operators label Oct 26, 2022
Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
@rajeevsrao rajeevsrao added this to the 1.13 milestone Oct 31, 2022
Comment thread onnx/defs/nn/defs.cc Outdated
Comment thread onnx/defs/nn/defs.cc Outdated
Comment thread onnx/defs/nn/defs.cc Outdated
Comment thread onnx/defs/nn/defs.cc Outdated
Comment thread onnx/defs/nn/defs.cc Outdated
Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
Comment thread onnx/backend/test/case/node/groupnorm.py Outdated
Comment thread onnx/backend/test/case/node/groupnorm.py Outdated
@gramalingam
Copy link
Copy Markdown
Contributor

LGTM. I think there may be a minor interaction between this PR and #4512 (which is rationalizing all Reduce* functions to take axes as an input instead of attribute) which will need to be resolved when both get merged.

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
@yuanyao-nv
Copy link
Copy Markdown
Contributor Author

@gramalingam Thanks for the suggestions. I've made the updates. Please review again. Thanks!

@gramalingam
Copy link
Copy Markdown
Contributor

gramalingam commented Nov 3, 2022

LGTM, thanks! I was wondering whether you had a chance to test the correctness of the function-body definition (eg., by running onnxruntime, or any other backend, on the generated expanded test-cases)? You may need to manually patch the opset of the generated test-cases to be the previous opset, and then it should be a valid test-case for the previous opset, I think, runnable by onnxruntime etc.

@yuanyao-nv
Copy link
Copy Markdown
Contributor Author

LGTM, thanks! I was wondering whether you had a chance to test the correctness of the function-body definition (eg., by running onnxruntime, or any other backend, on the generated expanded test-cases)? You may need to manually patch the opset of the generated test-cases to be the previous opset, and then it should be a valid test-case for the previous opset, I think, runnable by onnxruntime etc.

Thanks for pointing this out. I just tested and actually found a small error in the function body. Now fixed.

@gramalingam gramalingam merged commit fe78700 into onnx:main Nov 4, 2022
@yuanyao-nv yuanyao-nv deleted the dev-groupnorm branch November 4, 2022 22:24
justinchuby pushed a commit to justinchuby/onnx that referenced this pull request Jan 27, 2023
* add GroupNormalization-18

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* clean up function body

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix lint error

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix pytest error in function body

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix lint error

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix lint error 2

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix lint error 3

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix lint error 4

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* update md files

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* review feedback

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix lint error

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* update python test script per review feedback

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix python script lint issue

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix more python lint issues

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix Reshape error

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
Co-authored-by: G. Ramalingam <grama@microsoft.com>
broune pushed a commit to broune/onnx that referenced this pull request May 6, 2023
* add GroupNormalization-18

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* clean up function body

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix lint error

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix pytest error in function body

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix lint error

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix lint error 2

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix lint error 3

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix lint error 4

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* update md files

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* review feedback

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix lint error

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* update python test script per review feedback

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix python script lint issue

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix more python lint issues

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

* fix Reshape error

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>

Signed-off-by: Yuan Yao <yuanyao@nvidia.com>
Co-authored-by: G. Ramalingam <grama@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: operator Issues related to ONNX operators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants