From 1076eda95f5fbdacd0a28e43fde595dbf04777bc Mon Sep 17 00:00:00 2001 From: jiangjiajun Date: Mon, 21 Sep 2020 07:11:43 +0000 Subject: [PATCH] fix bug for GPU and MKLDNN --- deploy/cpp/src/paddlex.cpp | 2 +- paddlex/deploy.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/cpp/src/paddlex.cpp b/deploy/cpp/src/paddlex.cpp index 5d33ae0..6d3c230 100644 --- a/deploy/cpp/src/paddlex.cpp +++ b/deploy/cpp/src/paddlex.cpp @@ -66,7 +66,7 @@ void Model::create_predictor(const std::string& model_dir, if (key == "") { config.SetModel(model_file, params_file); } - if (use_mkl) { + if (use_mkl && !use_gpu) { if (name != "HRNet" && name != "DeepLabv3p" && name != "PPYOLO") { config.EnableMKLDNN(); config.SetCpuMathLibraryNumThreads(mkl_thread_num); diff --git a/paddlex/deploy.py b/paddlex/deploy.py index 12570be..b04f46e 100644 --- a/paddlex/deploy.py +++ b/paddlex/deploy.py @@ -108,7 +108,7 @@ class Predictor: config.enable_use_gpu(100, gpu_id) else: config.disable_gpu() - if use_mkl: + if use_mkl and not use_gpu: if self.model_name not in ["HRNet", "DeepLabv3p", "PPYOLO"]: config.enable_mkldnn() config.set_cpu_math_library_num_threads(mkl_thread_num) -- GitLab