From 11c72b1132feca7c1252ea01d02da4cb497e723f Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Thu, 11 Jun 2015 22:38:58 +0000
Subject: [PATCH] testing on one image

---
 src/convolutional_kernels.cu |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/convolutional_kernels.cu b/src/convolutional_kernels.cu
index 5b49091..d260a95 100644
--- a/src/convolutional_kernels.cu
+++ b/src/convolutional_kernels.cu
@@ -11,22 +11,22 @@
 __global__ void bias_output_kernel(float *output, float *biases, int n, int size)
 {
     int offset = blockIdx.x * blockDim.x + threadIdx.x;
-    int filter = blockIdx.y % n;
-    int batch = blockIdx.y / n;
+    int filter = blockIdx.y;
+    int batch = blockIdx.z;
 
     if(offset < size) output[(batch*n+filter)*size + offset] = biases[filter];
 }
 
 void bias_output_gpu(float *output, float *biases, int batch, int n, int size)
 {
-    dim3 dimGrid((size-1)/BLOCK + 1, n*batch, 1);
+    dim3 dimGrid((size-1)/BLOCK + 1, n, batch);
     dim3 dimBlock(BLOCK, 1, 1);
 
     bias_output_kernel<<<dimGrid, dimBlock>>>(output, biases, n, size);
     check_error(cudaPeekAtLastError());
 }
 
-__global__ void backward_bias_kernel(float *bias_updates, float *delta, int batch, int n, int size, float scale)
+__global__ void backward_bias_kernel(float *bias_updates, float *delta, int batch, int n, int size)
 {
     __shared__ float part[BLOCK];
     int i,b;
@@ -42,13 +42,13 @@
     part[p] = sum;
     __syncthreads();
     if(p == 0){
-        for(i = 0; i < BLOCK; ++i) bias_updates[filter] += scale * part[i];
+        for(i = 0; i < BLOCK; ++i) bias_updates[filter] += part[i];
     }
 }
 
 void backward_bias_gpu(float *bias_updates, float *delta, int batch, int n, int size)
 {
-    backward_bias_kernel<<<n, BLOCK>>>(bias_updates, delta, batch, n, size, 1);
+    backward_bias_kernel<<<n, BLOCK>>>(bias_updates, delta, batch, n, size);
     check_error(cudaPeekAtLastError());
 }
 

--
Gitblit v1.10.0