Skip to content

Commit 2242336

Browse files
committed
fix device_guard on CPU place
1 parent 0c2f262 commit 2242336

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

paddle/fluid/framework/new_executor/interpretercore.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ void InterpreterCore::BuildOpFuncList(const platform::Place& place,
512512
(op_base->Attr<std::string>("op_device").length() > 0));
513513
if (need_change_place) {
514514
auto& op_device = op_base->Attr<std::string>("op_device");
515-
if (op_device == "cpu") {
515+
if (op_device == "cpu" || platform::is_cpu_place(place)) {
516516
VLOG(3) << "Switch into CPUPlace by device_guard.";
517517
expected_kernel_key.place_ = platform::CPUPlace();
518518
} else if (op_device.find("gpu") != std::string::npos &&

0 commit comments

Comments
 (0)