8
$\begingroup$

enter image description here

From the documentation of Pytorch for Convolution, I saw the function torch.nn.Conv1d requires users to pass the parameters "in_channels" and "out_channels". I know they refer to input channels and output channels but I am not sure about what they mean in the context of convolution. Could someone explain this to me?

$\endgroup$

1 Answer 1

9
$\begingroup$

in_channels is the number of channels of the input to the convolutional layer. So, for example, in the case of the convolutional layer that applies to the image, in_channels refers to the number of channels of the image. In the case of an RGB image, in_channels == 3 (red, green and blue); in the case of a gray image, in_channels == 1.

out_channels is the number of feature maps, which is often equivalent to the number of kernels that you apply to the input. See e.g. https://stats.stackexchange.com/a/292064/82135 for more info.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.