提交 be855163 编写于 作者: F fengjiayi 提交者: GitHub

Remove attribute check from CreateGradOpDescs() (#4723)

* Remove attr_checker from CreateGradOpDescs()

* Fix merge error

* Fix bug in backward_test.cc
上级 36de3989
...@@ -451,6 +451,7 @@ TEST(Backward, default_attribute) { ...@@ -451,6 +451,7 @@ TEST(Backward, default_attribute) {
op->SetInput("X", {"x"}); op->SetInput("X", {"x"});
op->SetInput("Y", {"y"}); op->SetInput("Y", {"y"});
op->SetOutput("Out", {"out"}); op->SetOutput("Out", {"out"});
op->CheckAttrs();
AppendBackward(program, {}); AppendBackward(program, {});
......
...@@ -59,6 +59,7 @@ void AddOp(const std::string& type, const VariableNameMap& inputs, ...@@ -59,6 +59,7 @@ void AddOp(const std::string& type, const VariableNameMap& inputs,
op->SetOutput(kv.first, kv.second); op->SetOutput(kv.first, kv.second);
} }
op->SetAttrMap(attrs); op->SetAttrMap(attrs);
op->CheckAttrs();
} }
// Tensors in feed value variable will only be in CPUPlace // Tensors in feed value variable will only be in CPUPlace
......
...@@ -62,11 +62,6 @@ std::unique_ptr<OperatorBase> OpRegistry::CreateOp(const OpDescBind& op_desc) { ...@@ -62,11 +62,6 @@ std::unique_ptr<OperatorBase> OpRegistry::CreateOp(const OpDescBind& op_desc) {
std::vector<std::unique_ptr<OpDescBind>> OpRegistry::CreateGradOpDescs( std::vector<std::unique_ptr<OpDescBind>> OpRegistry::CreateGradOpDescs(
OpDescBind* op_desc) { OpDescBind* op_desc) {
auto& info = OpInfoMap::Instance().Get(op_desc->Type()); auto& info = OpInfoMap::Instance().Get(op_desc->Type());
if (info.Checker() != nullptr) {
info.Checker()->Check(*op_desc->MutableAttrMap());
}
return info.grad_op_maker_(*op_desc); return info.grad_op_maker_(*op_desc);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册