From 82f2c190960cfceae7faa48f3c9c28cb3c9db2b8 Mon Sep 17 00:00:00 2001 From: liuruilong Date: Fri, 26 Oct 2018 15:43:11 +0800 Subject: [PATCH] format files --- .../kernel/cl/conv_add_bn_relu_kernel.cpp | 4 +- test/framework/test_load.cpp | 6 +- test/net/test_yologpu.cpp | 76 +++++++++---------- 3 files changed, 42 insertions(+), 44 deletions(-) diff --git a/src/operators/kernel/cl/conv_add_bn_relu_kernel.cpp b/src/operators/kernel/cl/conv_add_bn_relu_kernel.cpp index ec81044f08..33172e4f03 100644 --- a/src/operators/kernel/cl/conv_add_bn_relu_kernel.cpp +++ b/src/operators/kernel/cl/conv_add_bn_relu_kernel.cpp @@ -125,7 +125,6 @@ bool ConvAddBNReluKernel::Init( param->SetOffset(offset); - /* if (param->Filter()->dims()[2] == 1 && param->Filter()->dims()[3] == 1 && @@ -136,8 +135,7 @@ bool ConvAddBNReluKernel::Init( DLOG << " conv add bn relu conv 1x1 4"; } */ - if (param->Filter()->dims()[2] == 1 && - param->Filter()->dims()[3] == 1) { + if (param->Filter()->dims()[2] == 1 && param->Filter()->dims()[3] == 1) { param->Filter()->InitNImage(cl_helper_.CLContext(), cl_helper_.CLCommandQueue()); this->cl_helper_.AddKernel("conv_1x1", "conv_add_bn_relu_kernel.cl"); diff --git a/test/framework/test_load.cpp b/test/framework/test_load.cpp index 6bb972be57..d158de1eb9 100644 --- a/test/framework/test_load.cpp +++ b/test/framework/test_load.cpp @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include #include +#include #include "../test_helper.h" #include "framework/loader.h" @@ -37,8 +37,8 @@ int main() { // auto program = loader.Load(g_mobilenet_ssd, true); -// auto program = loader.Load(std::string(g_ocr) + "/model", -// std::string(g_ocr) + "/params", false); + // auto program = loader.Load(std::string(g_ocr) + "/model", + // std::string(g_ocr) + "/params", false); // program.originProgram->Description("program desc: "); return 0; diff --git a/test/net/test_yologpu.cpp b/test/net/test_yologpu.cpp index f6899277f8..b00cbef027 100644 --- a/test/net/test_yologpu.cpp +++ b/test/net/test_yologpu.cpp @@ -17,50 +17,50 @@ limitations under the License. */ #include "../test_include.h" int main() { - paddle_mobile::PaddleMobile paddle_mobile; - // paddle_mobile.SetThreadNum(4); - auto time1 = paddle_mobile::time(); - // auto isok = paddle_mobile.Load(std::string(g_mobilenet_detect) + "/model", - // std::string(g_mobilenet_detect) + "/params", true); + paddle_mobile::PaddleMobile paddle_mobile; + // paddle_mobile.SetThreadNum(4); + auto time1 = paddle_mobile::time(); + // auto isok = paddle_mobile.Load(std::string(g_mobilenet_detect) + "/model", + // std::string(g_mobilenet_detect) + "/params", true); - auto isok = paddle_mobile.Load(std::string(g_yolo_mul), true); - if (isok) { - auto time2 = paddle_mobile::time(); - std::cout << "load cost :" << paddle_mobile::time_diff(time1, time2) << "ms" - << std::endl; + auto isok = paddle_mobile.Load(std::string(g_yolo_mul), true); + if (isok) { + auto time2 = paddle_mobile::time(); + std::cout << "load cost :" << paddle_mobile::time_diff(time1, time2) << "ms" + << std::endl; - std::vector input; - std::vector dims{1, 3, 416, 416}; - GetInput(g_yolo_img, &input, dims); + std::vector input; + std::vector dims{1, 3, 416, 416}; + GetInput(g_yolo_img, &input, dims); - std::vector vec_result; - // = paddle_mobile.Predict(input, dims); + std::vector vec_result; + // = paddle_mobile.Predict(input, dims); - auto time3 = paddle_mobile::time(); - int max = 10; - for (int i = 0; i < max; ++i) { - vec_result = paddle_mobile.Predict(input, dims); - } - auto time4 = paddle_mobile::time(); + auto time3 = paddle_mobile::time(); + int max = 10; + for (int i = 0; i < max; ++i) { + vec_result = paddle_mobile.Predict(input, dims); + } + auto time4 = paddle_mobile::time(); - // auto time3 = paddle_mobile::time(); + // auto time3 = paddle_mobile::time(); - // for (int i = 0; i < 10; ++i) { - // auto vec_result = paddle_mobile.Predict(input, dims); - // } + // for (int i = 0; i < 10; ++i) { + // auto vec_result = paddle_mobile.Predict(input, dims); + // } - // auto time4 = paddle_mobile::time(); + // auto time4 = paddle_mobile::time(); - std::cout << "predict cost :" - << paddle_mobile::time_diff(time3, time4) / max << "ms" - << std::endl; - std::vector::iterator biggest = - std::max_element(std::begin(vec_result), std::end(vec_result)); - std::cout << " Max element is " << *biggest << " at position " - << std::distance(std::begin(vec_result), biggest) << std::endl; -// for (float i : vec_result) { -// std::cout << i << std::endl; -// } - } - return 0; + std::cout << "predict cost :" + << paddle_mobile::time_diff(time3, time4) / max << "ms" + << std::endl; + std::vector::iterator biggest = + std::max_element(std::begin(vec_result), std::end(vec_result)); + std::cout << " Max element is " << *biggest << " at position " + << std::distance(std::begin(vec_result), biggest) << std::endl; + // for (float i : vec_result) { + // std::cout << i << std::endl; + // } + } + return 0; } -- GitLab