How to deal with multi-channels Array

A （rows：60， cols：62，dim：2，channel：32） and F（rows：9， cols：9，dim：2，channel：32）.

I want to compute Convolution with A and F, but it failed because the channel of A is more than 3. So the official API filter2d() not support this input Array!!!
Now, I implement this function with for-loop :

Split A into vector vecA，and the vecA.size=A.channel = 32 , the same as F and vecF.