提交 a64a6f52 编写于 作者: Y Yang Yang

id to block_id

上级 7c48335b
...@@ -39,11 +39,11 @@ bool HasDependentVar(const OpDesc& op_desc, ...@@ -39,11 +39,11 @@ bool HasDependentVar(const OpDesc& op_desc,
return false; return false;
} }
void Prune(const ProgramDesc& input, ProgramDesc& output, int id) { void Prune(const ProgramDesc& input, ProgramDesc& output, int block_id) {
// TODO(tonyyang-svail): // TODO(tonyyang-svail):
// - will change to use multiple blocks for RNN op and Cond Op // - will change to use multiple blocks for RNN op and Cond Op
auto& block = input.blocks(id); auto& block = input.blocks(block_id);
auto& ops = block.ops(); auto& ops = block.ops();
bool expect_feed = true; bool expect_feed = true;
...@@ -85,11 +85,11 @@ void Prune(const ProgramDesc& input, ProgramDesc& output, int id) { ...@@ -85,11 +85,11 @@ void Prune(const ProgramDesc& input, ProgramDesc& output, int id) {
std::reverse(should_run.begin(), should_run.end()); std::reverse(should_run.begin(), should_run.end());
output = input; output = input;
auto* op_field = output.mutable_blocks(id)->mutable_ops(); auto* op_field = output.mutable_blocks(block_id)->mutable_ops();
op_field->Clear(); op_field->Clear();
for (size_t i = 0; i < should_run.size(); ++i) { for (size_t i = 0; i < should_run.size(); ++i) {
if (should_run[i]) { if (should_run[i]) {
*op_field->Add() = input.blocks(id).ops(i); *op_field->Add() = input.blocks(block_id).ops(i);
} }
} }
......
...@@ -20,7 +20,7 @@ limitations under the License. */ ...@@ -20,7 +20,7 @@ limitations under the License. */
namespace paddle { namespace paddle {
namespace framework { namespace framework {
void Prune(const ProgramDesc& input, ProgramDesc& output, int id); void Prune(const ProgramDesc& input, ProgramDesc& output, int block_id);
} // namespace framework } // namespace framework
} // namespace paddle } // namespace paddle
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册