From 8763badbe06cebb02f45b1bc99cc55dd489490ea Mon Sep 17 00:00:00 2001 From: Monkeyking Date: Sat, 7 Mar 2020 23:15:54 +0800 Subject: [PATCH] test: Fix bottom_blob of ROIPooling test --- tests/test_roipooling.cpp | 83 ++++++++------------------------------- 1 file changed, 17 insertions(+), 66 deletions(-) diff --git a/tests/test_roipooling.cpp b/tests/test_roipooling.cpp index 0839a2260..85264daa3 100644 --- a/tests/test_roipooling.cpp +++ b/tests/test_roipooling.cpp @@ -17,18 +17,17 @@ #include "layer.h" #include "layer/roipooling.h" -static int RandomInt(float a = -2.f, float b = 2.f) -{ - return RandomFloat( a, b ) / 1; -} static int test_roipooling(int w, int h, int c, int pooled_width, int pooled_height, float spatial_scale) { std::vector a; - int num_rois = RandomInt(2, 1000); - for(int i=0; i("ROIPooling", pd, weights, opt, a); if (ret != 0) { - fprintf(stderr, "test_roipooling failed base_w=%d base_h=%d base_c=%d num_rois=%d pooled_width=%d pooled_height=%d spatial_scale=%4f.3\n", w, h, c, num_rois, pooled_width, pooled_height, spatial_scale); + fprintf(stderr, "test_roipooling failed base_w=%d base_h=%d base_c=%d pooled_width=%d pooled_height=%d spatial_scale=%4f.3\n", w, h, c, pooled_width, pooled_height, spatial_scale); } return ret; @@ -57,62 +56,16 @@ static int test_roipooling(int w, int h, int c, int pooled_width, int pooled_hei static int test_roipooling_0() { - for (int i=0; i<11; i++) - { - int ret = 0 - || test_roipooling(2, 2, 81, 4, 4, 0.0156) - || test_roipooling(4, 4, 27, 7, 7, 0.0312) - || test_roipooling(9, 9, 9, 14, 14, 0.0625) - || test_roipooling(15, 21, 81, 8, 6, 0.0123) - || test_roipooling(17, 23, 27, 27, 17, 0.0370) - || test_roipooling(19, 25, 9, 80, 53, 0.1111) - ; - - if (ret != 0) - return -1; - } - - return 0; -} - -static int test_roipooling_1() -{ - for (int i=0; i<11; i++) - { - int ret = 0 - || test_roipooling(2, 2, 27, 4, 4, 0.0156) - || test_roipooling(4, 4, 9, 7, 7, 0.0312) - || test_roipooling(9, 9, 3, 14, 14, 0.0625) - || test_roipooling(4, 21, 27, 12, 9, 0.0123) - || test_roipooling(17, 23, 9, 38, 29, 0.0370) - || test_roipooling(105, 65, 3, 113, 85, 0.1111) - ; - - if (ret != 0) - return -1; - } - - return 0; -} - -static int test_roipooling_2() -{ - for (int i=0; i<11; i++) - { - int ret = 0 - || test_roipooling(4, 7, 1, 4, 5, 0.0156) - || test_roipooling(6, 11, 2, 6, 7, 0.0312) - || test_roipooling(9, 17, 3, 14, 17, 0.0625) - || test_roipooling(13, 19, 4, 15, 18, 0.1250) - || test_roipooling(15, 21, 7, 18, 21, 0.0123) - || test_roipooling(17, 23, 8, 21, 25, 0.0370) - || test_roipooling(19, 25, 15, 21, 26, 0.1111) - || test_roipooling(23, 31, 16, 25, 34, 0.3333) - ; + int ret = 0 + || test_roipooling(112, 112, 16 , 56, 56, 0.50000) + || test_roipooling(56 , 56 , 32 , 28, 28, 0.25000) + || test_roipooling(28 , 28 , 64 , 14, 14, 0.12500) + || test_roipooling(14 , 14 , 128, 27, 17, 0.06250) + || test_roipooling(7 , 7 , 256, 3, 3, 0.03125) + ; - if (ret != 0) - return -1; - } + if (ret != 0) + return -1; return 0; } @@ -123,7 +76,5 @@ int main() return 0 || test_roipooling_0() - || test_roipooling_1() - || test_roipooling_2() ; }