support testing when training and handle dropout and batch_norm operator in testing mode#5734
Merged
QiJune merged 13 commits intoPaddlePaddle:developfrom Nov 24, 2017
Merged
Conversation
JiayiFeng
reviewed
Nov 21, 2017
paddle/framework/prune.cc
Outdated
| op_desc.type() == kBatchNormOpType) { | ||
| for (auto& attr : *op_desc.mutable_attrs()) { | ||
| if (attr.name() == "is_test") { | ||
| attr.set_b(true); |
paddle/framework/prune.cc
Outdated
| void Prune(const ProgramDesc& input, ProgramDesc* output) { | ||
| prune_impl(input, output, 0); | ||
| void Prune(const ProgramDesc& input, ProgramDesc* output, bool is_test) { | ||
| prune_impl(input, output, 0, is_test); |
Collaborator
There was a problem hiding this comment.
I think setting attribute is_test true has no relationship with prune. We shall add an independent function or module to do this.
Member
Author
There was a problem hiding this comment.
We now have prune method to transform ProgramDesc and generate another ProgramDesc.
Exactly, we will do some optimization in inference stage and handle some special operators. Then, we will generate an inference ProgramDesc.
You are right. Maybe we need another method like prune, the interface could be:
void InferenceOptimize(const ProgramDesc& input, ProgramDesc* output);
reyoung
reviewed
Nov 24, 2017
| prune_impl(input, output, 0); | ||
| } | ||
|
|
||
| void inference_optimize_impl(const ProgramDesc& input, ProgramDesc* output, |
Collaborator
There was a problem hiding this comment.
The logic of inference_optimize_impl is quite simple. Maybe we can implement it in Python.
reyoung
approved these changes
Nov 24, 2017
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 #5733 and Fix #5814