I have simple questions about the groups
argument in convolutions. In the following script:
# Cin: #of channels, b: batch size, w: kernel size
# L: Input length, K: some integer constant
m = nn.Conv1d(Cin, Cin*K, w, groups=Cin)
tensor = torch.rand((b, Cin, L))
out = m(tensor)
# 'out' is of dimension [b, Cin*K, L-w+1]
Question 1: Are the result of convolutions on the i th input channel in out[:, i*K:(i+1)*K, :]
or out[:, i:Cin:, :]
?
Question 2: How should I properly reshape out
into size [b, Cin, K, L-w+1]
or [b, K, Cin, L-w+1]
? (any of them that is easier is fine.)