From d1dee103e0a8eb6d637808e73ca7d6122b7b3b7c Mon Sep 17 00:00:00 2001 From: Rong Liu <102014841+RongLiu-Leo@users.noreply.github.com> Date: Sat, 1 Jun 2024 13:09:40 -0700 Subject: [PATCH] fix bugs for Windows compiling --- encoding/lib/cpu/nms_cpu.cpp | 4 ++-- encoding/lib/gpu/lib_ssd.cu | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/encoding/lib/cpu/nms_cpu.cpp b/encoding/lib/cpu/nms_cpu.cpp index b04446f7..a861de4c 100644 --- a/encoding/lib/cpu/nms_cpu.cpp +++ b/encoding/lib/cpu/nms_cpu.cpp @@ -67,7 +67,7 @@ std::vector Non_Max_Suppression_CPU( rawMask[i] = 0; } ++pos; - while(pos < (1+batch)*num_boxes-1 and (rawMask[pos] == 0)) + while(pos < (1+batch)*num_boxes-1 && (rawMask[pos] == 0)) ++pos; } } @@ -89,7 +89,7 @@ std::vector Non_Max_Suppression_CPU( rawMask[i] = 0; } ++pos; - while(pos < (1+batch)*num_boxes-1 and (rawMask[pos] == 0)) + while(pos < (1+batch)*num_boxes-1 && (rawMask[pos] == 0)) ++pos; } } diff --git a/encoding/lib/gpu/lib_ssd.cu b/encoding/lib/gpu/lib_ssd.cu index 61311746..89170749 100644 --- a/encoding/lib/gpu/lib_ssd.cu +++ b/encoding/lib/gpu/lib_ssd.cu @@ -111,9 +111,9 @@ void reduce_val_idx(int N, volatile float *vals, volatile int *idx) { **/ template __global__ -void encode(const int N_img, const float4 *bbox_in, const long *labels_in, const int *offsets, +void encode(const int N_img, const float4 *bbox_in, const int64_t *labels_in, const int *offsets, const int M, const float4 *dboxes, // const float *ious, - const float criteria, uint8_t *workspace, float4 *bbox_out, long *label_out) { + const float criteria, uint8_t *workspace, float4 *bbox_out, int64_t *label_out) { // Each block will take a single image's IoU set const int img = blockIdx.x; @@ -250,7 +250,7 @@ void encode(const int N_img, const float4 *bbox_in, const long *labels_in, const /** # filter IoU > 0.5 masks = best_dbox_ious > criteria - labels_out = torch.zeros(self.nboxes, dtype=torch.long) + labels_out = torch.zeros(self.nboxes, dtype=torch.int64_t) #print(maxloc.shape, labels_in.shape, labels_out.shape) labels_out[masks] = labels_in[best_dbox_idx[masks]] bboxes_out = self.dboxes.clone() @@ -323,7 +323,7 @@ void encode(const int N_img, const float4 *bbox_in, const long *labels_in, const # filter IoU > 0.5 masks = best_dbox_ious > criteria - labels_out = torch.zeros(self.nboxes, dtype=torch.long) + labels_out = torch.zeros(self.nboxes, dtype=torch.int64_t) #print(maxloc.shape, labels_in.shape, labels_out.shape) labels_out[masks] = labels_in[best_dbox_idx[masks]] bboxes_out = self.dboxes.clone() @@ -373,7 +373,7 @@ std::vector box_encoder(const int N_img, #ifdef DEBUG printf("%d x %d\n", N_img * M, 4); // at::Tensor bbox_out = dbox.scalar_type().tensor({N_img * M, 4}); - printf("allocating %lu bytes for output labels\n", N_img*M*sizeof(long)); + printf("allocating %lu bytes for output labels\n", N_img*M*sizeof(int64_t)); #endif at::Tensor labels_out = at::empty({N_img * M}, labels_input.options()); C10_CUDA_CHECK(cudaGetLastError()); @@ -397,14 +397,14 @@ std::vector box_encoder(const int N_img, const int THREADS_PER_BLOCK = 256; encode<<>>(N_img, (float4*)bbox_input.data_ptr(), - labels_input.data_ptr(), + labels_input.data_ptr(), bbox_offsets.data_ptr(), M, (float4*)dbox.data_ptr(), criteria, workspace.data_ptr(), (float4*)bbox_out.data_ptr(), - labels_out.data_ptr()); + labels_out.data_ptr()); C10_CUDA_CHECK(cudaGetLastError()); return {bbox_out, labels_out};