Fix 'convolution.c' padding issues

This commit is contained in:
julienChemillier 2023-05-20 15:43:31 +02:00
parent 08993ade85
commit 8e8a57c5b3
2 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ void make_convolution_cpu(Kernel_cnn* kernel, float*** input, float*** output, i
int x = (stride*j+b);
int y = (stride*k+c);
if (not_outside(x, y, 0, input_width)) {
f += kernel->weights[a][i][b][c]*input[a][stride*j+b][stride*k+c];
f += kernel->weights[a][i][b+padding][c+padding]*input[a][x][y];
}
}
}
@ -62,7 +62,7 @@ __global__ void make_convolution_kernel(float**** weights, float*** bias, int k_
int idy_2 = idy*stride+b;
int idz_2 = idz*stride+c;
if (not_outside(idy_2, idz_2, 0, input_width)) {
f += weights[a][idx][b][c]*input[a][idy_2][idz_2];
f += weights[a][idx][b+padding][c+padding]*input[a][idy_2][idz_2];
}
}
}

View File

@ -29,7 +29,7 @@ void make_convolution_cpu(Kernel_cnn* kernel, float*** input, float*** output, i
int x = (stride*j+b);
int y = (stride*k+c);
if (not_outside(x, y, 0, input_width)) {
f += kernel->weights[a][i][b][c]*input[a][stride*j+b][stride*k+c];
f += kernel->weights[a][i][b+padding][c+padding]*input[a][x][y];
}
}
}
@ -62,7 +62,7 @@ __global__ void make_convolution_kernel(float**** weights, float*** bias, int k_
int idy_2 = idy*stride+b;
int idz_2 = idz*stride+c;
if (not_outside(idy_2, idz_2, 0, input_width)) {
f += weights[a][idx][b][c]*input[a][idy_2][idz_2];
f += weights[a][idx][b+padding][c+padding]*input[a][idy_2][idz_2];
}
}
}