remove the initialization of saved_mean and saved_variance for batch_norm op #33851
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)如下: