From 65adfecf37311fba6d5ecf657a18c15525f14e48 Mon Sep 17 00:00:00 2001 From: wanghuancoder Date: Mon, 14 Mar 2022 16:44:13 +0800 Subject: [PATCH] [Eager] [Bug Fix] fix eager trace op bug (#40402) * fix some slice bug, test=develop * refine, test=develop --- python/paddle/fluid/dygraph/tracer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/paddle/fluid/dygraph/tracer.py b/python/paddle/fluid/dygraph/tracer.py index 563cd433910..a7dd938a1cf 100644 --- a/python/paddle/fluid/dygraph/tracer.py +++ b/python/paddle/fluid/dygraph/tracer.py @@ -140,7 +140,12 @@ class Tracer(core.Tracer): outputs[retname][j].reconstruct_from_(returns[i][j], False) else: - outputs[retname][0].reconstruct_from_(returns[i], False) + if isinstance(outputs[retname], list): + outputs[retname][0].reconstruct_from_(returns[i], + False) + else: + outputs[retname].reconstruct_from_(returns[i], + False) elif isinstance(returns, list): assert len(outputs.keys()) == 1 key = list(outputs.keys())[0] -- GitLab