From f3fde458c6cc48613269a643cfe2acf689caccd3 Mon Sep 17 00:00:00 2001 From: Allen Guo Date: Thu, 21 Jul 2022 12:36:47 +0800 Subject: [PATCH] up x --- python/paddle/fluid/executor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/paddle/fluid/executor.py b/python/paddle/fluid/executor.py index 88f610c535417b..3bf91a80a4392d 100755 --- a/python/paddle/fluid/executor.py +++ b/python/paddle/fluid/executor.py @@ -1484,7 +1484,10 @@ def _can_use_interpreter_core(program, place): # NOTE(dev): `set` always call TensorCopySync that is a # blocking behavior. So we use `_copy_from` to replace it. cpu_tensor = _as_lodtensor(data, core.CPUPlace()) - tensor._copy_from(cpu_tensor, tensor._place()) + if tensor._is_initialized(): + tensor._copy_from(cpu_tensor, tensor._place()) + else: + tensor._copy_from(cpu_tensor, self.place) return new_exe.run(scope, list(feed.keys()), fetch_list, return_numpy)