From d8ddd3b3078ebf5ce7c374b78f2bfd598ae38f49 Mon Sep 17 00:00:00 2001 From: minqiyang Date: Mon, 30 Jul 2018 15:47:30 +0800 Subject: [PATCH] Add TODO for memory optimization in python3 and polishing code --- python/paddle/fluid/io.py | 1 + python/paddle/fluid/transpiler/distribute_transpiler.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/python/paddle/fluid/io.py b/python/paddle/fluid/io.py index 38001e841b2..55e517f1f4a 100644 --- a/python/paddle/fluid/io.py +++ b/python/paddle/fluid/io.py @@ -606,6 +606,7 @@ def save_inference_model(dirname, feeded_var_names = [feeded_var_names.encode()] else: if len(feeded_var_names) > 0: + # TODO(paddle-dev): polish these code blocks if not (bool(feeded_var_names) and all( isinstance(name, six.binary_type) for name in feeded_var_names)): diff --git a/python/paddle/fluid/transpiler/distribute_transpiler.py b/python/paddle/fluid/transpiler/distribute_transpiler.py index a28cb79e622..8b5a48e7eda 100644 --- a/python/paddle/fluid/transpiler/distribute_transpiler.py +++ b/python/paddle/fluid/transpiler/distribute_transpiler.py @@ -1245,6 +1245,8 @@ class DistributeTranspiler(object): def _is_splited_grad_var(self, var, var_dict): grad_block = None + # TODO(minqiyang): replace these items() with six.iteritems() to + # improve memory for _, g in list(var_dict.items()): if self._orig_varname(g.name) == self._orig_varname(var.name): if g.name.find(".trainer_") == -1: -- GitLab