# How is a filter actually applied to all input channels in a ConvLayer2D

I was studying Convolutional Layers and some of their variations and I came across this post which says:

'For rgb vs greyscale, think about channels as feature maps for input layer and a filter gets applied on all feature map at once.'

I also watched some videos that say the same thing, however I can't quite understand how the process actually happens. Let's look at the image below:

Now, lets pretend that we feed an RGB image to a ConvLayer2D. Since we have an RGB image we also have 3 input channels, one for each color. Lets also suppose that the ConvLayer has 32 filters. From what I understood the output of this layer will be 32 feature maps which means that each filter will apply convolutions to each of the 3 input channels and combine its convolved feature into one feature map related to that same filter. But how does that mixing/combining actually work? Does it produce 3 convolved feature maps (one for each channel input) and then combine its elements by some adding and dividing each elements of said convolved features before putting them into the final feature map? Or does it achieve the 32 feature maps in some other way?

For example: ((Red-i00 + Green-i00 + Blue-i00) / 3 = FinalFeatureMapOfThatFilter-i00 ) Where i00 represents the top, leftmost position of the related convolved feature.

Thanks!

If you have a conv layer that has 3 input channels and 32 output channels (i.e. the number of filters), then you essentially have $$3 \times 32$$ convolution operations connecting every input channel to every output channel (unless you are doing depthwise-separable convolution which is a different story). This gives you $$3 \times 32$$ sets of convolution kernels.