oa::ml::matrix::unfold
Extract sliding NCHW kernel windows into a [N, C * kernel², L] column Matrix. Each column holds one kernel_size × kernel_size patch per input channel in (channel, kernel_y, kernel_x) order, laid out over the L = output_height * output_width sliding positions where output = floor((input + 2 * padding - dilation * (kernel - 1) - 1) / stride) + 1 on every spatial axis. Out-of-bounds taps read as zero, matching the donor im2col contract. Errors Returns an error unless input is a nonempty NCHW rank-four F32 Matrix, kernel/stride/dilation are nonzero, the effective kernel fits the padded input, every extent fits the shader ABI, or recording fails.
Function Documentation
Extract sliding NCHW kernel windows into a [N, C * kernel², L] column Matrix. Each column holds one kernel_size × kernel_size patch per input channel in (channel, kernel_y, kernel_x) order, laid out over the L = output_height * output_width sliding positions where output = floor((input + 2 * padding - dilation * (kernel - 1) - 1) / stride) + 1 on every spatial axis. Out-of-bounds taps read as zero, matching the donor im2col contract. Errors Returns an error unless input is a nonempty NCHW rank-four F32 Matrix, kernel/stride/dilation are nonzero, the effective kernel fits the padded input, every extent fits the shader ABI, or recording fails.