Channels and neurons in a CNN I am in the process of learning what a convolutional layer is, and its functions. I have a couple of questions. One is what in_channels and out_channels are. In my code, I have the following:
nn.Conv2d(in_channels=3, out_channels=64, kernel_size=(4,4), padding=1)

I understand that the in_channels for this layer is 3 because RGB, but I'm confused on why out_channels is 64, and why I can change it to seemingly any other number without the program crashing.
Another question is what exactly a &quot;neuron&quot; is. For convolutional layers, is a neuron each filter? Also, if it is, what do the activation functions judge when evaluating each filter?
out_channels can be thought of as the number of features/filters the layer can learn. So, for eg., if a layer of a CNN has out_channels set to 64, it can &quot;learn&quot; 64 features. These features could be edges/patterns. This is a hyper-parameters and can set to an arbitrary number.
The activation of a neuron in a layer will be high if the input to that layer contains the feature learned by the layer, that's how a convolution (or correlation) function works.
In a CNN, a neuron is the result of computing the dot product of the input and the filter/kernel at every window of the convolution.