Hi,
I’m so new at Pytorch, and I’m trying to convert my Keras model into Pytorch one. In Keras, I can use the kernel_size = 20 with the same data and I worked well. However, when I define as 20 with the same data and architectire in Pytorch, I got the following error. I can’t really understand the main reason for this error since It was working well in Keras.
I’d be appreciated If you could make me understand the issue and solution.
RuntimeError                              Traceback (most recent call last)
<ipython-input-25-74505e66d6bf> in <module>
     17 
     18         # Forward pass
---> 19         outputs = model(dataX.float())
     20         loss = criterion(outputs, labels)
     21 

~\Anaconda3\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, *input, **kwargs)
    887             result = self._slow_forward(*input, **kwargs)
    888         else:
--> 889             result = self.forward(*input, **kwargs)
    890         for hook in itertools.chain(
    891                 _global_forward_hooks.values(),

<ipython-input-19-6d0943e3b0de> in forward(self, x)
     28         x = self.maxpool1(x)
     29         print("x", x.size())
---> 30         x = self.cnn3(x)
     31         print("cnn3", x.size())
     32         x = self.act3(x)

~\Anaconda3\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, *input, **kwargs)
    887             result = self._slow_forward(*input, **kwargs)
    888         else:
--> 889             result = self.forward(*input, **kwargs)
    890         for hook in itertools.chain(
    891                 _global_forward_hooks.values(),

~\Anaconda3\lib\site-packages\torch\nn\modules\conv.py in forward(self, input)
    261 
    262     def forward(self, input: Tensor) -> Tensor:
--> 263         return self._conv_forward(input, self.weight, self.bias)
    264 
    265 

~\Anaconda3\lib\site-packages\torch\nn\modules\conv.py in _conv_forward(self, input, weight, bias)
    257                             weight, bias, self.stride,
    258                             _single(0), self.dilation, self.groups)
--> 259         return F.conv1d(input, weight, bias, self.stride,
    260                         self.padding, self.dilation, self.groups)
    261 

RuntimeError: Calculated padded input size per channel: (3). Kernel size: (20). Kernel size can't be greater than actual input size```