diff --git a/paddle/fluid/framework/ir/graph_helper.cc b/paddle/fluid/framework/ir/graph_helper.cc index 315fe3b1e7eee24d6f923d6637236c47c5651095..97f486065ac622375cde539fb231c5c8dc099463 100644 --- a/paddle/fluid/framework/ir/graph_helper.cc +++ b/paddle/fluid/framework/ir/graph_helper.cc @@ -452,6 +452,7 @@ static OpDesc *ReplaceScaleLossGradOp(const Node &node, OpDesc *desc) { OpProtoAndCheckerMaker::OpRoleAttrName(), (static_cast(OpRole::kBackward) | static_cast(OpRole::kLoss))); desc->SetAttr("value", 1.0f); + desc->SetAttr("shape", std::vector({1})); std::vector output_names; for (auto out : node.outputs) { output_names.emplace_back(out->Name()); diff --git a/python/paddle/fluid/tests/unittests/interpreter/CMakeLists.txt b/python/paddle/fluid/tests/unittests/interpreter/CMakeLists.txt index c60a7511022b422b1a59a4d06b2007e2a148d75d..ee215ebf27a391d15ceff25512c2b0f492b33dda 100644 --- a/python/paddle/fluid/tests/unittests/interpreter/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/interpreter/CMakeLists.txt @@ -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)