未验证 提交 7cf72a38 编写于 作者: P pangyoki 提交者: GitHub

add shape attribute in fill_constant op converted from scale_loss_grad after...

add shape attribute in fill_constant op converted from scale_loss_grad after convert graph to program (#43898)

* fix grad loss shape

* little change

* delete for_test

* add unittest for FLAGS_CONVERT_GRAPH_TO_PROGRAM

* avoid conflict
上级 033ef5e9
......@@ -452,6 +452,7 @@ static OpDesc *ReplaceScaleLossGradOp(const Node &node, OpDesc *desc) {
OpProtoAndCheckerMaker::OpRoleAttrName(),
(static_cast<int>(OpRole::kBackward) | static_cast<int>(OpRole::kLoss)));
desc->SetAttr("value", 1.0f);
desc->SetAttr("shape", std::vector<int64_t>({1}));
std::vector<std::string> output_names;
for (auto out : node.outputs) {
output_names.emplace_back(out->Name());
......
......@@ -55,3 +55,6 @@ py_test_modules(
py_test_modules(
test_standalone_executor_serial_run MODULES test_standalone_executor ENVS
FLAGS_new_executor_serial_run=true)
py_test_modules(test_convert_graph_to_program MODULES test_standalone_executor
ENVS FLAGS_CONVERT_GRAPH_TO_PROGRAM=true)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册