提交 d8ddd3b3 编写于 作者: M minqiyang

Add TODO for memory optimization in python3 and polishing code

上级 7f794ea5
...@@ -606,6 +606,7 @@ def save_inference_model(dirname, ...@@ -606,6 +606,7 @@ def save_inference_model(dirname,
feeded_var_names = [feeded_var_names.encode()] feeded_var_names = [feeded_var_names.encode()]
else: else:
if len(feeded_var_names) > 0: if len(feeded_var_names) > 0:
# TODO(paddle-dev): polish these code blocks
if not (bool(feeded_var_names) and all( if not (bool(feeded_var_names) and all(
isinstance(name, six.binary_type) isinstance(name, six.binary_type)
for name in feeded_var_names)): for name in feeded_var_names)):
......
...@@ -1245,6 +1245,8 @@ class DistributeTranspiler(object): ...@@ -1245,6 +1245,8 @@ class DistributeTranspiler(object):
def _is_splited_grad_var(self, var, var_dict): def _is_splited_grad_var(self, var, var_dict):
grad_block = None grad_block = None
# TODO(minqiyang): replace these items() with six.iteritems() to
# improve memory
for _, g in list(var_dict.items()): for _, g in list(var_dict.items()):
if self._orig_varname(g.name) == self._orig_varname(var.name): if self._orig_varname(g.name) == self._orig_varname(var.name):
if g.name.find(".trainer_") == -1: if g.name.find(".trainer_") == -1:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册