From 77e07b532427b9aa3485d4c3f5eb05a590cda9be Mon Sep 17 00:00:00 2001 From: Jeff Donahue Date: Tue, 18 Mar 2014 18:19:25 -0700 Subject: [PATCH] use CUDA_KERNEL_LOOP in padding layer --- src/caffe/layers/padding_layer.cu | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/caffe/layers/padding_layer.cu b/src/caffe/layers/padding_layer.cu index f19294ba..7ec28a9e 100644 --- a/src/caffe/layers/padding_layer.cu +++ b/src/caffe/layers/padding_layer.cu @@ -12,8 +12,7 @@ template __global__ void PaddingForward(const int count, const Dtype* in, Dtype* out, const int num, const int channel, const int height_in, const int width_in, const int pad) { - int index = threadIdx.x + blockIdx.x * blockDim.x; - if (index < count) { + CUDA_KERNEL_LOOP(index, count) { int height_out = height_in + pad + pad; int width_out = width_in + pad + pad; int w = index % width_in; @@ -46,8 +45,7 @@ template __global__ void PaddingBackward(const int count, const Dtype* in, Dtype* out, const int num, const int channel, const int height_in, const int width_in, const int pad) { - int index = threadIdx.x + blockIdx.x * blockDim.x; - if (index < count) { + CUDA_KERNEL_LOOP(index, count) { int height_out = height_in + pad + pad; int width_out = width_in + pad + pad; int w = index % width_in; -- 2.34.1