From 734260f47b5df3dbc16d880cc25efdf7aac01700 Mon Sep 17 00:00:00 2001 From: minqiyang Date: Thu, 11 Apr 2019 11:01:11 +0800 Subject: [PATCH] Make Op Hold Output too and release backward_refs each time test=develop --- python/paddle/fluid/dygraph/tracer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/paddle/fluid/dygraph/tracer.py b/python/paddle/fluid/dygraph/tracer.py index e5e715bcdce..ad938188bfb 100644 --- a/python/paddle/fluid/dygraph/tracer.py +++ b/python/paddle/fluid/dygraph/tracer.py @@ -25,6 +25,8 @@ __all__ = ['Tracer'] def release_op(op): del framework._dygraph_tracer()._ops[op._trace_id].inputs + del framework._dygraph_tracer()._ops[op._trace_id].outputs + del framework._dygraph_tracer()._ops[op._trace_id].backward_refs class Tracer(core.Tracer): @@ -60,6 +62,7 @@ class Tracer(core.Tracer): op.previous_ops.append(var.op) inps[k].append(var._ivar) + op.outputs = outputs outs = defaultdict(list) for k, vars in six.iteritems(outputs): if isinstance(vars, framework.Variable): -- GitLab