未验证 提交 e26f80ad 编写于 作者: F feifei-111 提交者: GitHub

Fix problem that the shape of tensor is not inited correctly when backward in static graph (#45030)

* fix_shape

* code style

* fix assert

* fix to_tensor badreturn
上级 ff2f1373
......@@ -255,6 +255,9 @@ class ConditionalBlockGradOp : public ConditionalOp {
const auto &input_tensors = input_var->Get<framework::LoDTensorArray>();
auto *outside_tensors =
outside_var->GetMutable<framework::LoDTensorArray>();
if (outside_tensors->size() == 0U) {
outside_tensors->resize(input_tensors.size());
}
PADDLE_ENFORCE_EQ(input_tensors.size(),
outside_tensors->size(),
platform::errors::InvalidArgument(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册