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)