Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions paddle/fluid/framework/op_desc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ void OpDesc::SetAttr(const std::string &name, const Attribute &v) {
need_update_ = true;
}

void OpDesc::SetBlockAttr(const std::string &name, BlockDesc &block) {
this->attrs_[name] = █
void OpDesc::SetBlockAttr(const std::string &name, BlockDesc *block) {
this->attrs_[name] = block;
need_update_ = true;
}

Expand Down
3 changes: 2 additions & 1 deletion paddle/fluid/framework/op_desc.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ limitations under the License. */

#pragma once

#include <string>
#include <unordered_map>
#include <vector>
#include "paddle/fluid/framework/attribute.h"
Expand Down Expand Up @@ -73,7 +74,7 @@ class OpDesc {

void SetAttr(const std::string &name, const Attribute &v);

void SetBlockAttr(const std::string &name, BlockDesc &block);
void SetBlockAttr(const std::string &name, BlockDesc *block);

Attribute GetAttr(const std::string &name) const;

Expand Down
4 changes: 2 additions & 2 deletions paddle/fluid/framework/program_desc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ProgramDesc::ProgramDesc(const ProgramDesc &o) {
for (const auto &attr : op->Proto()->attrs()) {
if (attr.type() == proto::AttrType::BLOCK) {
size_t blk_idx = attr.block_idx();
op->SetBlockAttr(attr.name(), *this->MutableBlock(blk_idx));
op->SetBlockAttr(attr.name(), this->MutableBlock(blk_idx));
}
}
}
Expand All @@ -73,7 +73,7 @@ ProgramDesc::ProgramDesc(const proto::ProgramDesc &desc) {
for (const auto &attr : op->Proto()->attrs()) {
if (attr.type() == proto::AttrType::BLOCK) {
size_t blk_idx = attr.block_idx();
op->SetBlockAttr(attr.name(), *this->MutableBlock(blk_idx));
op->SetBlockAttr(attr.name(), this->MutableBlock(blk_idx));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/operators/conditional_block_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class ConditionalBlockGradMaker : public framework::SingleGradOpDescMaker {
grad_op->SetOutput(framework::GradVarName("X"), InputGrad("X", false));
grad_op->SetOutput(framework::GradVarName("Params"),
InputGrad("Params", false));
grad_op->SetBlockAttr("sub_block", *this->grad_block_[0]);
grad_op->SetBlockAttr("sub_block", this->grad_block_[0]);
grad_op->SetAttr("is_scalar_condition", GetAttr("is_scalar_condition"));
return std::unique_ptr<framework::OpDesc>(grad_op);
}
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/operators/parallel_do_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ class ParallelDoGradOpDescMaker : public framework::SingleGradOpDescMaker {
}
}
grad->SetAttrMap(this->Attrs());
grad->SetBlockAttr(kParallelBlock, *grad_block_[0]);
grad->SetBlockAttr(kParallelBlock, grad_block_[0]);

return std::unique_ptr<framework::OpDesc>(grad);
}
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/operators/recurrent_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ class RecurrentGradOpDescMaker : public framework::SingleGradOpDescMaker {
}
}
grad->SetAttrMap(this->Attrs());
grad->SetBlockAttr(kStepBlock, *grad_block_[0]);
grad->SetBlockAttr(kStepBlock, grad_block_[0]);

return std::unique_ptr<framework::OpDesc>(grad);
}
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/operators/while_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class WhileGradOpDescMaker : public framework::SingleGradOpDescMaker {
while_grad->SetInput(framework::GradVarName(kOutputs), output_grads_list);

while_grad->SetAttrMap(this->Attrs());
while_grad->SetBlockAttr(kStepBlock, *grad_block);
while_grad->SetBlockAttr(kStepBlock, grad_block);
// record the original output gradient names, since the gradient name of
// while operator could be renamed.
while_grad->SetAttr("original_output_grad", output_grads_list);
Expand Down