提交 f469bb6b 编写于 作者: M minqiyang

Polish code

test=develop
上级 ac88c62a
...@@ -127,8 +127,6 @@ class VarBase { ...@@ -127,8 +127,6 @@ class VarBase {
public: public:
virtual ~VarBase() { virtual ~VarBase() {
// LOG(ERROR) << "remove var " << name_;
if (block_ && !persistable_) { if (block_ && !persistable_) {
block_->RemoveVar(name_); block_->RemoveVar(name_);
} }
......
...@@ -24,10 +24,6 @@ __all__ = ['Tracer'] ...@@ -24,10 +24,6 @@ __all__ = ['Tracer']
def release_op(op): 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] del framework._imperative_tracer()._ops[op._trace_id]
...@@ -59,6 +55,8 @@ class Tracer(core.Tracer): ...@@ -59,6 +55,8 @@ class Tracer(core.Tracer):
if len(backward_refs) > 0: if len(backward_refs) > 0:
op.iop.register_backward_hooks(release_op) op.iop.register_backward_hooks(release_op)
# TODO(minqiyang): remove all inputs and outputs after seperate
# var and grad
op.backward_refs = defaultdict(list) op.backward_refs = defaultdict(list)
for k, v in six.iteritems(op.inputs): for k, v in six.iteritems(op.inputs):
if k in backward_refs: if k in backward_refs:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册