How to Use 1d Convolution?


I have a simple use case.

I want to apply a convolution on the previous input of a decoder.

Previous input will have a different size than the current one.

How can I make a single conv layer that works?

So, I get the previous input from my decoder. I want to convolve over it. How should I proceed?

If I pad my previous input to some global size, I will get conv output that I dont want. If I don’t pad I cant make it work.

I am also confused as to what is the shape of the input passed to this convolution layer? How to create it?

self.conv1dlayer = nn.Conv1d(1, 1, 4, stride=1, padding = 2)
RuntimeError: Given groups=1, weight of size [1, 1, 4], expected input[32, 71, 30] to have 1 channels, but got 71 channels instead

What I want is a layer that operates with a 1 d vector whose size will change in each iteration and I am feeding input in a minibatch.

Is the question answered in this thread or do you need more input to this particular issue? :slight_smile:

I don’t think there is a way to have a dynamic convolutional layer. What about padding and then only using parts of the output tensor?