From f469bb6b367cf844ae885b4a10c89788e8d0bdae Mon Sep 17 00:00:00 2001 From: minqiyang Date: Wed, 27 Feb 2019 16:49:13 +0800 Subject: [PATCH] Polish code test=develop --- paddle/fluid/imperative/layer.h | 2 -- python/paddle/fluid/imperative/tracer.py | 6 ++---- .../{test_imperative.py => test_imperative_basic.py} | 0 3 files changed, 2 insertions(+), 6 deletions(-) rename python/paddle/fluid/tests/unittests/{test_imperative.py => test_imperative_basic.py} (100%) diff --git a/paddle/fluid/imperative/layer.h b/paddle/fluid/imperative/layer.h index c9b6dde2633..74d0035f79b 100644 --- a/paddle/fluid/imperative/layer.h +++ b/paddle/fluid/imperative/layer.h @@ -127,8 +127,6 @@ class VarBase { public: virtual ~VarBase() { - // LOG(ERROR) << "remove var " << name_; - if (block_ && !persistable_) { block_->RemoveVar(name_); } diff --git a/python/paddle/fluid/imperative/tracer.py b/python/paddle/fluid/imperative/tracer.py index 8b53d6c2822..1064ad63e71 100644 --- a/python/paddle/fluid/imperative/tracer.py +++ b/python/paddle/fluid/imperative/tracer.py @@ -24,10 +24,6 @@ __all__ = ['Tracer'] def release_op(op): - import gc - assert len( - gc.get_referrers(framework._imperative_tracer()._ops[ - op._trace_id])) == 1 del framework._imperative_tracer()._ops[op._trace_id] @@ -59,6 +55,8 @@ class Tracer(core.Tracer): if len(backward_refs) > 0: op.iop.register_backward_hooks(release_op) + # TODO(minqiyang): remove all inputs and outputs after seperate + # var and grad op.backward_refs = defaultdict(list) for k, v in six.iteritems(op.inputs): if k in backward_refs: diff --git a/python/paddle/fluid/tests/unittests/test_imperative.py b/python/paddle/fluid/tests/unittests/test_imperative_basic.py similarity index 100% rename from python/paddle/fluid/tests/unittests/test_imperative.py rename to python/paddle/fluid/tests/unittests/test_imperative_basic.py -- GitLab