From 83b16ab7b71bec486be7a6f013ddfb77653dd0f8 Mon Sep 17 00:00:00 2001 From: Li Peng Date: Thu, 1 Feb 2018 02:09:13 +0800 Subject: [PATCH] fix extra spaces in build option Signed-off-by: Li Peng --- modules/dnn/src/layers/batch_norm_layer.cpp | 2 +- modules/dnn/src/layers/mvn_layer.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/dnn/src/layers/batch_norm_layer.cpp b/modules/dnn/src/layers/batch_norm_layer.cpp index 8acf8b2477..52ce95f57f 100644 --- a/modules/dnn/src/layers/batch_norm_layer.cpp +++ b/modules/dnn/src/layers/batch_norm_layer.cpp @@ -144,7 +144,7 @@ public: UMat src = inputs[ii].reshape(1, s.size(), &s[0]); UMat dst = outputs[ii].reshape(1, s.size(), &s[0]); int number = (s[1] % 8 == 0) ? 8 : ((s[1] % 4 == 0) ? 4 : 1); - String buildopt = format("-DNUM=%d ", number); + String buildopt = format("-DNUM=%d", number); String kname = format("batch_norm%d", number); ocl::Kernel kernel(kname.c_str(), ocl::dnn::batchnorm_oclsrc, buildopt); if (kernel.empty()) diff --git a/modules/dnn/src/layers/mvn_layer.cpp b/modules/dnn/src/layers/mvn_layer.cpp index 1d5e12b2b6..a74bc0e14e 100644 --- a/modules/dnn/src/layers/mvn_layer.cpp +++ b/modules/dnn/src/layers/mvn_layer.cpp @@ -132,7 +132,7 @@ public: int number = (s[1] % 8 == 0) ? 8 : ((s[1] % 4 == 0) ? 4 : 1); size_t global[] = { (size_t)s[0], (size_t)(s[1] / number) }; - String buildopt = format("-DNUM=%d ", number); + String buildopt = format("-DNUM=%d", number); if (normVariance) { String kname = format("calc_mean%d", number); @@ -156,9 +156,9 @@ public: } String kname = format("mvn%d", number); - buildopt += format("%s %s %s ", (normVariance) ? "-DNORM_VARIANCE" : "", - (fuse_batch_norm) ? "-DFUSE_BATCH_NORM" : "", - (fuse_relu) ? "-DFUSE_RELU" : ""); + buildopt += format("%s%s%s", (normVariance) ? " -DNORM_VARIANCE" : "", + (fuse_batch_norm) ? " -DFUSE_BATCH_NORM" : "", + (fuse_relu) ? " -DFUSE_RELU" : ""); ocl::Kernel kernel1(kname.c_str(), ocl::dnn::mvn_oclsrc, buildopt); if (kernel1.empty()) return false;