Skip to content
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

remove the initialization of saved_mean and saved_variance for batch_norm op #33851

Merged
merged 1 commit into from
Jun 30, 2021

Conversation

limin2021
Copy link
Contributor

@limin2021 limin2021 commented Jun 30, 2021

PR types

Performance optimization

PR changes

OPs

Describe

remove the initialization of saved_mean and saved_variance for batch_norm op

ctest结果:

Test project /benchmark/bn-remove-eigenfill/Paddle/build

test 290
Start 290: test_batch_norm_op
1/2 Test 290: test_batch_norm_op ............... Passed 7.25 sec
test 291
Start 291: test_batch_norm_op_v2
2/2 Test 291: test_batch_norm_op_v2 ............ Passed 7.14 sec

The following tests passed:
test_batch_norm_op
test_batch_norm_op_v2

100% tests passed, 0 tests failed out of 2

Total Test time (real) = 14.50 sec

以fp32,NCHW格式为例,展示优化前后 batch_norm 算子的前向+反向的总时间情况。
benchmark 性能数据(单位:ms)如下:

Input shape Before optimization After optimization Speed
[-1L, 256L] 14.2568 11.6356 1.22527416
[-1L, 32768L] 686.22 674.5369 1.01732018
[-1L, 1536L, 33L, 33L] 903.8521 892.5328 1.01268222
[-1L, 256L, 1L, 1L] 12.4789 11.6477 1.07136173
[-1L, 32L, 256L, 256L] 2024.9894 2000.9023 1.01203812

@CLAassistant
Copy link

CLAassistant commented Jun 30, 2021

CLA assistant check
All committers have signed the CLA.

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Copy link
Contributor

@zhangting2020 zhangting2020 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhangting2020 zhangting2020 merged commit 79e75bc into PaddlePaddle:develop Jun 30, 2021
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.

3 participants