How to apply temporal conv on 1D data?

I am a little confuse regarding applying temporal convolution on the 1D data and appreciate it if someone can help me understand if I am doing it right.
I have temporal data (x) in shape of B x C x T (batch,channels,times). If I define conv=nn.conv1d(C,C,3), would it means that I am applying convolution temporally with kernel 3 on the temporal dimension when I do conv(x)?

Yes, your description is correct.
The conv layer will use a kernel size of 3 and will apply the convolution on the T dimension creating 3 activations maps.

B, C, T = 3, 4, 10
x = torch.randn(B, C, T)
conv = nn.Conv1d(C, C, 3)
out = conv(x)
> torch.Size([3, 4, 8])
1 Like