未验证 提交 40bfe0eb 编写于 作者: S ShenLiang 提交者: GitHub

fix bug of release output in pp (#54624)

上级 d658940a
......@@ -671,11 +671,19 @@ class PipelineParallel(MetaParallelBase):
self.lr_scheduler.step()
def _release_output(self, output):
def can_free(t):
return (
t is not None
and isinstance(t, paddle.Tensor)
and t.inplace_version == 0
)
if isinstance(output, (tuple, list)):
for t in output:
if t is not None and isinstance(t, paddle.Tensor):
if can_free(t):
t._clear_dataptr()
elif output is not None and isinstance(output, paddle.Tensor):
elif can_free(output):
output._clear_dataptr()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册