From 0883cf37bef9ca7db37ece787f3ccab3f817a9ae Mon Sep 17 00:00:00 2001 From: Aurelius84 Date: Fri, 7 Jan 2022 17:38:38 +0800 Subject: [PATCH] [newExe]Fix blocking in lr_sheduler from Executor (#38786) --- 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 8702c800498..7f282b8cea0 100644 --- a/python/paddle/fluid/executor.py +++ b/python/paddle/fluid/executor.py @@ -1416,7 +1416,10 @@ class Executor(object): [lr_value]).astype(convert_dtype(lr_var.dtype)) tensor = core.get_variable_tensor(scope, lr_sheduler._var_name) - tensor.set(data, self.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, self.place) return new_exe.run(list(feed.keys()), fetch_list, return_numpy) -- GitLab