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

[BugFix] fix bug of release output in pp (#54625)

上级 974676bc
......@@ -673,11 +673,20 @@ 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._is_initialized()
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.
先完成此消息的编辑!
想要评论请 注册