@Mazhar_Shaikh  Using unfold, I can create a matrix from the input and do a matrix multiplication with the kernel vector.
However, what I need would be a matrix from the kernel, not the input. Which seems not possible with unfold (as the kernel is smaller than the input). Do you know of an alternative?