python - Convolution of 3d array with 2d kernel for each channel separately

Viewed 6015

I have a matrix of size [c, n, m] where c is a number of channels; n and m are width and height. In the particular example I have a matrix that has 1000 channels. I want to make a convolution with a kernel of the size a x a for each channel separately. In my example the kernel size is 3 x 3. Is there any function in scipy or numpy that does that kind of operation without iterating through the channels with a loop?

I found scipy.ndimage.convolve function but I think that I can not apply that function on this problem without using a loop.

2 Answers
Related