From 17a311e285b9bcea5bbac91907d5aef691d9ddd3 Mon Sep 17 00:00:00 2001 From: typhoonzero Date: Thu, 1 Mar 2018 16:23:19 +0800 Subject: [PATCH] fix rename de-ref again --- python/paddle/fluid/distribute_transpiler.py | 2 -- python/paddle/fluid/framework.py | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/distribute_transpiler.py b/python/paddle/fluid/distribute_transpiler.py index 497bcf93a37..bb2ce4d45d5 100644 --- a/python/paddle/fluid/distribute_transpiler.py +++ b/python/paddle/fluid/distribute_transpiler.py @@ -279,7 +279,6 @@ class DistributeTranspiler: type=v.type, dtype=v.dtype, shape=v.shape) - print("create origin var: ", orig_var_name) for trainer_id in xrange(self.trainers): var = pserver_program.global_block().create_var( name="%s.trainer_%d" % (orig_var_name, trainer_id), @@ -288,7 +287,6 @@ class DistributeTranspiler: dtype=v.dtype, shape=v.shape) recv_inputs.append(var) - print("create per trainer var: ", var.name) # step3 optimize_block = pserver_program.create_block(0) # step 4 diff --git a/python/paddle/fluid/framework.py b/python/paddle/fluid/framework.py index 4ec0bca2284..f921b93f1bd 100644 --- a/python/paddle/fluid/framework.py +++ b/python/paddle/fluid/framework.py @@ -773,7 +773,7 @@ class Block(object): stop_gradient = v.stop_gradient else: raise ValueError("unsupported var type: %s", type(v)) - + orig_var_type = v.type self.desc.rename_var(name, new_name) # NOTE: v is destroyed by C++ after calling rename_var. d = self.desc.find_var(new_name) @@ -782,6 +782,7 @@ class Block(object): self, d.shape(), d.dtype(), + type=orig_var_type, name=new_name, stop_gradient=stop_gradient, trainable=trainable, @@ -792,7 +793,7 @@ class Block(object): elif var_type == "Variable": var = Variable( self, - type=v.type, + type=orig_var_type, name=new_name, error_clip=error_clip, stop_gradient=stop_gradient) -- GitLab