Why 8 layer output for 3 channel RGB image

I have a question, in the lecture while you were teaching the topic of the kernel. Here the image has three channels so we are taking 3 kernels. So the output should be 3 layers. One channel of image passing through one kernel. Or if one channel passes through all 3 kernels then we should get 9 outputs. 3 kernel * 3 channel = 9 layer output. But My question is why we are getting 8 layer output.

Here in Conv2d function, we are passing 3 for 3 kernels but why 8 for output.

nn.Conv2d(3, 8...)

3-channel input.
8-channel output.

There are actually 8 kernels, each of them 3 channels deep (input), each looking at 3x3 pixels (kernel_size) at once.

Each 3x3x3 kernel produces a single value. That’s why there are 8 kernels - so the output has 8 channels.

2 Likes