From 2a6a259d73666091ea710df019a238cf951096f4 Mon Sep 17 00:00:00 2001 From: Wilber Date: Fri, 18 Oct 2019 16:20:12 +0800 Subject: [PATCH] fix yolobox_cuda_test (#2208) fix yolobox_cuda test precision error --- lite/kernels/cuda/yolo_box_compute_test.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lite/kernels/cuda/yolo_box_compute_test.cc b/lite/kernels/cuda/yolo_box_compute_test.cc index 26b890c9f1..994251b249 100644 --- a/lite/kernels/cuda/yolo_box_compute_test.cc +++ b/lite/kernels/cuda/yolo_box_compute_test.cc @@ -89,7 +89,7 @@ inline static void calc_label_score(float* scores, template static void YoloBoxRef(const T* input, - const T* imgsize, + const int* imgsize, T* boxes, T* scores, const float conf_thresh, @@ -106,8 +106,8 @@ static void YoloBoxRef(const T* input, float box[4]; for (int i = 0; i < n; i++) { - int img_height = static_cast(imgsize[2 * i]); - int img_width = static_cast(imgsize[2 * i + 1]); + int img_height = imgsize[2 * i]; + int img_width = imgsize[2 * i + 1]; for (int j = 0; j < an_num; j++) { for (int k = 0; k < h; k++) { @@ -184,12 +184,12 @@ TEST(yolo_box, normal) { auto* scores_data = scores.mutable_data(TARGET(kCUDA)); float* x_cpu_data = x_cpu.mutable_data(); - float* sz_cpu_data = sz_cpu.mutable_data(); + int* sz_cpu_data = sz_cpu.mutable_data(); float* boxes_cpu_data = boxes_cpu.mutable_data(); float* scores_cpu_data = scores_cpu.mutable_data(); float* x_ref_data = x_ref.mutable_data(); - float* sz_ref_data = sz_ref.mutable_data(); + int* sz_ref_data = sz_ref.mutable_data(); float* boxes_ref_data = boxes_ref.mutable_data(); float* scores_ref_data = scores_ref.mutable_data(); @@ -203,7 +203,7 @@ TEST(yolo_box, normal) { sz_ref_data[1] = 32; x.Assign(x_cpu_data, x_cpu.dims()); - sz.Assign(sz_cpu_data, sz_cpu.dims()); + sz.Assign(sz_cpu_data, sz_cpu.dims()); param.X = &x; param.ImgSize = &sz; -- GitLab