未验证 提交 23d253e1 编写于 作者: Z Zhen Wang 提交者: GitHub

Fix out of range error for outs map. test=develop (#24774)

上级 d1047d0a
......@@ -75,7 +75,7 @@ std::map<std::string, std::set<std::string>> op_passing_outs_map = {
{"fill_constant", {"Out"}},
{"matmul", {"Out"}},
{"fake_quantize_dequantize_moving_average_abs_max",
{"OutScale", "OutAccum", "OutState"}},
{"Out", "OutScale", "OutAccum", "OutState"}},
};
// clang-format off
......@@ -99,15 +99,11 @@ const char* INPUT_INITIALIZER_TEMPLATE_WITH_NULL_LIST = R"(
)";
const char* OUTPUT_INITIALIZER_TEMPLATE_WITH_NULL = R"(
if (%s != nullptr) {
outs["%s"] = {%s};
}
)";
const char* OUTPUT_INITIALIZER_TEMPLATE_WITH_NULL_LIST = R"(
if (%s.size() != 0) {
outs["%s"] = %s;
}
)";
// if inputs is list, no need {}
const char* ARG_OUT_NUM = R"(%sNum)";
......@@ -246,8 +242,8 @@ GenerateOpFunctions(const std::string& module_name) {
const auto out_template =
output.duplicable() ? OUTPUT_INITIALIZER_TEMPLATE_WITH_NULL_LIST
: OUTPUT_INITIALIZER_TEMPLATE_WITH_NULL;
outs_initializer_with_null += paddle::string::Sprintf(
out_template, out_name, out_name, out_name);
outs_initializer_with_null +=
paddle::string::Sprintf(out_template, out_name, out_name);
} else {
const auto out_template = output.duplicable()
? INPUT_LIST_INITIALIZER_TEMPLATE
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册