From bd262fba629225414d9e5d7aed6cdee46b66bd9d Mon Sep 17 00:00:00 2001 From: Bin Li Date: Wed, 23 Sep 2020 16:54:23 +0800 Subject: [PATCH] perf: Prefer GPU if input ops on different devices --- mace/core/net_optimizer.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mace/core/net_optimizer.cc b/mace/core/net_optimizer.cc index 4382b51b..f1dd0fde 100644 --- a/mace/core/net_optimizer.cc +++ b/mace/core/net_optimizer.cc @@ -41,10 +41,10 @@ DeviceType NetOptimizer::SelectBestDevice( } // Greedy strategy: Use input op's device type as current op's device for (auto device_type : inputs_op_devices) { - if (device_type != best_device) { - best_device = device_type; + if (device_type == best_device) { + return best_device; } } - return best_device; + return DeviceType::CPU; } } // namespace mace -- GitLab