Solved by ptrblck in post #2 
              
              
                You could unfold the input to apply the im2col transformation and reshape the kernels to the kernel matrix as explained in this blog post by Pete Warden.