While reading about 1D-convolutions in PyTorch, I encountered the concept of channels.

in_channels (int) – Number of channels in the input image

out_channels (int) – Number of channels produced by the convolution

Although I encountered this concept of channels earlier, I am confused about channels and might understand them in the wrong manner.

Since the operation we are discussing is a 1D convolution, then there will be two lists of numbers: one is the input list and the other is the filter list. The last one is the feature map (the output list).

They look like this:

1-D convolution

The left one is the input list, the middle one is the filter list and the rightmost one is the output list.

Each cell in the input list contains a whole number. Each cell may take a value in the fixed range $[a, b]$ of numbers.

What is the concept of channels used here? From where the channels are coming? Does the number of channels stand for the number of elements in the corresponding list?


2 Answers 2


Channels can be thought of as alternate numbers in the same space.

As an example, the three colour channels of a typical image are often values for amount of red, green or blue light received from each position within the picture.

Your 1D convolution example has one input channel and one output channel. Depending on what the input represents, you might have additional input channels representing other values measured in the same input space. For all but the most simple problems, you will have multiple output channels. The number of channels in each layer may vary, similarly to how the size of hidden layers in a fully connected neural network can vary.

The term "feature map" means the same as channel, and is typically used to describe the outputs of hidden layers.

To map from N input channels to M output channels requires $N \times M$ filters. Each of the M outputs is connected by a filter to each of the N inputs, and the results of running those N convolutions is summed and passed through a nonlinear activation function to generate an output channel.

Although in the abstract, a channel is a type of dimension, channels are considered as entirely separate to the space which is being processed. So adding channels to your 1D example does not make it a 2D convolutional neural network.

  • 2
    $\begingroup$ In NLP, the channels are the word vector (embedding) dimensions. $\endgroup$
    – hobs
    May 30, 2022 at 11:50
  • $\begingroup$ Then a 1x1 convolution just calculates de summation of all channels values at every pixel? Or does it something more complex such as weighted summation and it calculates the best weights as parameters for the model? $\endgroup$
    – skan
    Dec 22, 2023 at 1:47
  • $\begingroup$ @skan it's a weighted sum with nonlinear filter, over all channels, and separately for each pixel $\endgroup$ Dec 22, 2023 at 8:13
  • $\begingroup$ @NeilSlater How does it calculate the weights? $\endgroup$
    – skan
    Dec 22, 2023 at 12:31
  • 1
    $\begingroup$ @skan they are normal NN weights, learned along with the rest during training. The only difference is the architecture has been deliberately chosen to adjust the channel count, and nothing else for that layer $\endgroup$ Dec 22, 2023 at 13:15

A common use case for 1d-convolution is to analyse & interpret time series data. Imagine a single sensor that generates a sequence of readings such as [1 2 3 4 2].

That is equivalent to a single channel.

However its also possible to have multiple sensors generating readings, such as

[ 1 2 3 2 4]
[ 2 3 4 1 2]
[ 3 4 5 1 2]

This would be equivalent to 3 channels of time series data that's consumed by a 1d convolution.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .