nn.Conv1d will use dim2 as the time axis and convolve (or rather cross-correlate) in this dimension.
Therefore, you would need to permute the dimensions in your input.
Here is a small example:
But the weight tensor then actually has the shape torch.Size([1, 6, 5]), while my kernel is just torch.Size([5]). Do you suggest to assign a repeated sequence of my kernel to the weights, such as
But also I expect an output of the same shape as the input, but in your example the output is of shape torch.Size([1, 1, 6]), which is different from the input shape torch.Size([1, 6, 6]). Above scipy function doesn’t change the shape.
The scipy function doesn’t change the shape because it uses padding, by default.
There is an optional padding option for torch.nn.Conv1d.
The shape of the weight tensor depends of the number of in_channels and out_channels.
In your example, can you clarify what does the size [6, 6, 1] of your tensor B correspond to ?