Skip to content
fn

col2im_1d_f32

void col2im_1d_f32(const float * cols, float * dx, int C, int L, int KL, int OL, int stride_l, int pad_l, int dilation_l)

Single-precision 1-D col2im fold (gradient transform).

Inverse of im2col_1d_f32: scatter-adds each column of cols back into the corresponding positions of dxdx. Overlapping receptive fields (stride < kernel) accumulate by sum — this is the mathematically correct adjoint that the conv1d backward needs.

Math

dx[c,l]=∑o,k:o⋅s+k⋅d−p=lcols[c⋅KL+k,o]dx[c, l] = \sum_{o, k : o \cdot s + k \cdot d - p = l} \text{cols}[c \cdot KL + k, o]

Parameters

colsconst float*
Column matrix, shape (C⋅KL,OL)(C \cdot KL, OL).
dxfloat*
Output gradient tensor, shape (C,L)(C, L); must be zeroed by the caller before this call.
C, L, KL, OLint
Channel count, input length, kernel length, output length.
stride_l, pad_l, dilation_lint
Match the convolution forward.