Difference between parameters in, out_channels:, kernel_size:, stride in torch.nn.Conv1d


I would like to know the difference between kernel_size and stride in conv1d class in torch.nn and how does they both work.

As i understand my input of size in_channels gets converted to out_channels but I can not get how out_channels, kernel_size and stride works out.

If out_channels is the output size then shouldn’t it be dependent on kernel_size and stride

Can someone please help to clarify this…as I am trying in code examples I am getting the input and output channels is fixed as we provide in object init…but the third parameter is changing with kernel_Size and stride.

My problem is to apply a 1D convolution over a 50 step time series data.
Can someone please help to clarify these parameters.


I would recommend reading this blogpost: https://towardsdatascience.com/intuitively-understanding-convolutions-for-deep-learning-1f6f42faee1 that explains this with very nice animations.
Let me know if you have any further question afterwards!