From 867de3e1a56cf0d9eca6512c42dcb8e7efab13bc Mon Sep 17 00:00:00 2001 From: zhaojiaying01 Date: Fri, 24 Aug 2018 15:32:20 +0800 Subject: [PATCH] fix annotation of unit test of net --- test/net/test_googlenet.cpp | 2 +- test/net/test_mobilenet+ssd.cpp | 2 +- test/net/test_mobilenet.cpp | 2 +- test/net/test_mobilenet_combine.cpp | 5 ++++- test/net/test_resnet.cpp | 6 ++++-- test/net/test_squeezenet.cpp | 2 +- test/net/test_yolo.cpp | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/test/net/test_googlenet.cpp b/test/net/test_googlenet.cpp index 96d9479eab..a2f030eeac 100644 --- a/test/net/test_googlenet.cpp +++ b/test/net/test_googlenet.cpp @@ -34,7 +34,7 @@ int main() { std::vector input; std::vector dims{1, 3, 224, 224}; GetInput(g_test_image_1x3x224x224, &input, dims); - // 预热一次 + // 预热十次 for (int i = 0; i < 10; ++i) { auto vec_result = paddle_mobile.Predict(input, dims); } diff --git a/test/net/test_mobilenet+ssd.cpp b/test/net/test_mobilenet+ssd.cpp index 0bb6fea0e7..85083ca441 100644 --- a/test/net/test_mobilenet+ssd.cpp +++ b/test/net/test_mobilenet+ssd.cpp @@ -32,7 +32,7 @@ int main() { std::vector dims{1, 3, 300, 300}; GetInput(g_hand, &input, dims); - // 预热一次 + // 预热十次 for (int i = 0; i < 10; ++i) { auto output = paddle_mobile.Predict(input, dims); } diff --git a/test/net/test_mobilenet.cpp b/test/net/test_mobilenet.cpp index fe7b431caf..4ed7d3b756 100644 --- a/test/net/test_mobilenet.cpp +++ b/test/net/test_mobilenet.cpp @@ -32,13 +32,13 @@ int main() { std::vector dims{1, 3, 224, 224}; GetInput(g_test_image_1x3x224x224_banana, &input, dims); - // 预热一次 auto vec_result = paddle_mobile.Predict(input, dims); 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 (int i = 0; i < 10; ++i) { auto vec_result = paddle_mobile.Predict(input, dims); } diff --git a/test/net/test_mobilenet_combine.cpp b/test/net/test_mobilenet_combine.cpp index af93d105ea..0736077959 100644 --- a/test/net/test_mobilenet_combine.cpp +++ b/test/net/test_mobilenet_combine.cpp @@ -29,13 +29,16 @@ int main() { std::vector dims{1, 3, 224, 224}; GetInput(g_test_image_1x3x224x224_banana, &input, dims); - // 预热一次 auto vec_result = paddle_mobile.Predict(input, dims); 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 (int i = 0; i < 10; ++i) { + auto vec_result = paddle_mobile.Predict(input, dims); + } auto time3 = time(); for (int i = 0; i < 10; ++i) { auto vec_result = paddle_mobile.Predict(input, dims); diff --git a/test/net/test_resnet.cpp b/test/net/test_resnet.cpp index 82fdc22763..f890646466 100644 --- a/test/net/test_resnet.cpp +++ b/test/net/test_resnet.cpp @@ -36,8 +36,10 @@ int main() { std::vector input(input_tensor.data(), input_tensor.data() + input_tensor.numel()); - // 预热一次 - paddle_mobile.Predict(input, dims); + // 预热十次 + for (int i = 0; i < 10; ++i) { + paddle_mobile.Predict(input, dims); + } auto time3 = time(); for (int i = 0; i < 10; ++i) { paddle_mobile.Predict(input, dims); diff --git a/test/net/test_squeezenet.cpp b/test/net/test_squeezenet.cpp index 3ed0299d9d..02ec8691fe 100644 --- a/test/net/test_squeezenet.cpp +++ b/test/net/test_squeezenet.cpp @@ -32,7 +32,7 @@ int main() { std::vector input(input_tensor.data(), input_tensor.data() + input_tensor.numel()); - // 预热一次 + // 预热十次 for (int i = 0; i < 10; ++i) { paddle_mobile.Predict(input, dims); } diff --git a/test/net/test_yolo.cpp b/test/net/test_yolo.cpp index bb566d8b8e..700eb10cac 100644 --- a/test/net/test_yolo.cpp +++ b/test/net/test_yolo.cpp @@ -33,7 +33,7 @@ int main() { std::vector input(input_tensor.data(), input_tensor.data() + input_tensor.numel()); - // 预热一次 + // 预热十次 for (int i = 0; i < 10; ++i) { paddle_mobile.Predict(input, dims); } -- GitLab