未验证 提交 20335b7c 编写于 作者: Y YuanRisheng 提交者: GitHub

fix bugs (#46951)

上级 97a68ad2
......@@ -490,9 +490,18 @@ std::vector<phi::MetaTensor*> CompatInferMetaContext::MutableOutputBetween(
size_t start, size_t end) {
std::vector<phi::MetaTensor*> result;
result.reserve(end - start);
bool has_meta_tensor = false;
for (size_t i = start; i < end; ++i) {
auto& out = compat_outputs_.at(i);
result.emplace_back(out.initialized() ? &out : nullptr);
if (!has_meta_tensor && out.initialized()) {
has_meta_tensor = true;
}
}
if (!has_meta_tensor) {
result.clear();
}
return result;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册