In that case the shape of a is wrong and depending if you are using nn.Conv1d or nn.Conv2d the weight parameter should have the shape [out_channels, in_channels, seq_len] or [out_channels, in_channels, height, width], respectively.