# 1D convolution but before the sum operation

Hello all~
For the F.conv1d function. Suppose I have the input

``````input = [[a, b, c],
[d, e, f]]
``````

And I have the weight

``````weight = [[x, y],
[z, w]]
``````

Mathematically, the F.conv1d function will return

``````output = [[a, b, c] * [x, y]] + [[d, e, f] * [z, w]] # * is the cross-correlation operator
``````

Now my problem is, I want to obtain the result before the sum operation, that is

``````desired_output = [[[a, b, c] * [x, y]],
[[d, e, f] * [z, w]]]
``````

How should I do so? The simplest solution is I can create multiple weights and then conv1d each of them with the corresponding input channel but that will involve a loop that I really don’t want.

Best regards,

You could use the `groups` argument as described here.

Thank you very much @ptrblck. I was suspecting the groups argument should do the job but the description on the official docs is so confusing.