How to compute 2D convolutions when the input has multiple channels

All the numerical examples of convolutions that I have seen thus far always assume that the input image has only 1 channel (for example, see this post on stack overflow). This made me wonder how the computations would work when the input image has multiple channels. I created this Sage worksheet to help me follow the computations.

Advertisements

1D Convolution when the input has multiple channels

I was reading this post about using 1D convolution on stack overflow and wondered how it would 1D work when the input has more than 1 channel and/or the output channel of the kernel is greater than one. So, I made this Sage Worksheet to see how the 1D convolution of a 2-channel 1-dimensional input vector with where the output channel of the kernel is 4 could be done by hand.