mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
smaller gridsize in bias
This commit is contained in:
parent
56b6561ae4
commit
e92f7d301c
@ -11,16 +11,16 @@ extern "C" {
|
|||||||
__global__ void bias_output_kernel(float *output, float *biases, int n, int size)
|
__global__ void bias_output_kernel(float *output, float *biases, int n, int size)
|
||||||
{
|
{
|
||||||
int offset = blockIdx.x * blockDim.x + threadIdx.x;
|
int offset = blockIdx.x * blockDim.x + threadIdx.x;
|
||||||
int filter = blockIdx.y;
|
int filter = blockIdx.y % n;
|
||||||
int batch = blockIdx.z;
|
int batch = blockIdx.y / n;
|
||||||
|
|
||||||
if(offset < size) output[(batch*n+filter)*size + offset] = biases[filter];
|
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)
|
void bias_output_gpu(float *output, float *biases, int batch, int n, int size)
|
||||||
{
|
{
|
||||||
|
dim3 dimGrid((size-1)/BLOCK + 1, n*batch, 1);
|
||||||
dim3 dimBlock(BLOCK, 1, 1);
|
dim3 dimBlock(BLOCK, 1, 1);
|
||||||
dim3 dimGrid((size-1)/BLOCK + 1, n, batch);
|
|
||||||
|
|
||||||
bias_output_kernel<<<dimGrid, dimBlock>>>(output, biases, n, size);
|
bias_output_kernel<<<dimGrid, dimBlock>>>(output, biases, n, size);
|
||||||
check_error(cudaPeekAtLastError());
|
check_error(cudaPeekAtLastError());
|
||||||
|
Loading…
Reference in New Issue
Block a user