From de388a59bfdadd0d854c57f070a358e422d2cd46 Mon Sep 17 00:00:00 2001 From: hong <43953930+phlrain@users.noreply.github.com> Date: Sat, 12 Oct 2019 00:27:14 +0800 Subject: [PATCH] get shape from var desc to avoid run startup program; test=develop (#20501) --- python/paddle/fluid/io.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/io.py b/python/paddle/fluid/io.py index 546c19d536..1f4220e519 100644 --- a/python/paddle/fluid/io.py +++ b/python/paddle/fluid/io.py @@ -653,10 +653,8 @@ def load_vars(executor, continue if isinstance(each_var, Parameter): - var_temp = paddle.fluid.global_scope().find_var(each_var.name) - assert var_temp != None, "can't not find var: " + each_var.name - orig_para_shape[each_var.name] = ( - np.array(var_temp.get_tensor())).shape + orig_para_shape[each_var.name] = tuple(each_var.desc.get_shape( + )) new_var = _clone_var_in_block_(load_block, each_var) if filename is None: load_block.append_op( -- GitLab