提交 af63b118 编写于 作者: J Jiabin Yang 提交者: chengduo

test=develop, fix memory leak in dygraph (#18998)

上级 a43a763b
......@@ -272,11 +272,15 @@ def name_scope(prefix=None):
g = f - 1
"""
# TODO(panyx0718): Only [0-9a-z].
assert prefix, "namescope prefix cannot be empty."
global _name_scope
_name_scope = _name_scope.child(prefix)
yield
_name_scope = _name_scope.parent()
# in dygraph we don't need namescope since it will cause mem leak
if not in_dygraph_mode():
assert prefix, "namescope prefix cannot be empty."
global _name_scope
_name_scope = _name_scope.child(prefix)
yield
_name_scope = _name_scope.parent()
else:
yield
def _full_name_scope():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册