4 int row,
int col,
int channel,
int pad,
float val)
9 if (row < 0 || col < 0 ||
10 row >= height || col >= width)
return;
11 im[col + width*(row + height*channel)] += val;
15 int channels,
int height,
int width,
16 int ksize,
int stride,
int pad,
float* data_im)
19 int height_col = (height + 2*pad - ksize) / stride + 1;
20 int width_col = (width + 2*pad - ksize) / stride + 1;
22 int channels_col = channels * ksize * ksize;
23 for (c = 0; c < channels_col; ++c) {
24 int w_offset = c % ksize;
25 int h_offset = (c / ksize) % ksize;
26 int c_im = c / ksize / ksize;
27 for (h = 0; h < height_col; ++h) {
28 for (w = 0; w < width_col; ++w) {
29 int im_row = h_offset + h * stride;
30 int im_col = w_offset + w * stride;
31 int col_index = (c * height_col + h) * width_col + w;
32 double val = data_col[col_index];
34 im_row, im_col, c_im, pad, val);
void col2im_add_pixel(float *im, int height, int width, int channels, int row, int col, int channel, int pad, float val)
void col2im_cpu(float *data_col, int channels, int height, int width, int ksize, int stride, int pad, float *data_im)