Enable is_test attr of batch norm and drop out op for test program#8642
Merged
Xreki merged 6 commits intoPaddlePaddle:developfrom Mar 6, 2018
Merged
Enable is_test attr of batch norm and drop out op for test program#8642Xreki merged 6 commits intoPaddlePaddle:developfrom
Xreki merged 6 commits intoPaddlePaddle:developfrom
Conversation
Xreki
reviewed
Mar 2, 2018
|
|
||
| void inference_optimize_impl(const proto::ProgramDesc& input, | ||
| proto::ProgramDesc* output, int block_id) { | ||
| *output = input; |
| @@ -205,7 +203,12 @@ void inference_optimize_impl(const proto::ProgramDesc& input, | |||
|
|
|||
Contributor
There was a problem hiding this comment.
这么看,原来的inference_program已经有这个修改了啊,那原来是我没注意到。我理解,无论是哪个op,只要有is_test这个属性,inference_program里面都应该设置成true才对,line 192 - 193对op type的判断是否可以去掉?
Contributor
Author
There was a problem hiding this comment.
是的,生成inference_program的时候就经过了inference_optimize函数的处理了。
你说的很有道理,已修改~
Xreki
reviewed
Mar 5, 2018
| @@ -205,7 +203,12 @@ void inference_optimize_impl(const proto::ProgramDesc& input, | |||
|
|
|||
|
|
||
| # Test program | ||
| test_program = fluid.default_main_program().clone() | ||
| test_program = fluid.default_main_program().clone_as_test_program() |
Contributor
There was a problem hiding this comment.
最好是所有的生成test_program都改一下?不然用户容易迷惑。
Contributor
Author
There was a problem hiding this comment.
所有三个生成test_program的地方都改了~
| p.sync_with_cpp() | ||
| p.copy_param_info_from(self) | ||
| return p | ||
|
|
Contributor
There was a problem hiding this comment.
或许我们可以给clone函数加个参数,变成clone(for_test=False),默认值为False,这样可以避免重复的代码实现,你觉得呢?另外需要加一些注释说明一下。
Contributor
Author
There was a problem hiding this comment.
Can't agree more. Done.
Xreki
approved these changes
Mar 6, 2018
Contributor
Xreki
left a comment
There was a problem hiding this comment.
LGTM. Thanks for your work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fix #8372