Kernel size can't be greater than actual input size
See original GitHub issueI’ve downloaded pre-trained model and deep speech.pytorch-1.1. When I try to transcribe audio, it throws RuntimeError: Calculated padded input size per channel: (61 x 6). Kernel size: (21 x 11). Kernel size can’t be greater than actual input size. Any advice?
I’m using CUDA-10.0, installations were all finished successfully.
edward@GPU-machine:~/deepspeech.pytorch-1.1$ python transcribe.py --model_path models/librispeech_pretrained.pth --audio_path fox_question.wav
Traceback (most recent call last):
File "transcribe.py", line 88, in <module>
out = model(Variable(spect, volatile=True))
File "/home/edward/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "/home/edward/deepspeech.pytorch-1.1/model.py", line 172, in forward
x = self.conv(x)
File "/home/edward/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "/home/edward/.local/lib/python3.6/site-packages/torch/nn/modules/container.py", line 91, in forward
input = module(input)
File "/home/edward/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "/home/edward/.local/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 301, in forward
self.padding, self.dilation, self.groups)
RuntimeError: Calculated padded input size per channel: (61 x 6). Kernel size: (21 x 11). Kernel size can't be greater than actual input size at /pytorch/aten/src/THNN/generic/SpatialConvolutionMM.c:48
‘’’
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Kernel size can't greater than actual input size - PyTorch Forums
Hi, I'm getting the following error. RuntimeError: Calculated padded input size per channel: (1017 x 1). Kernel size: (3 x 3). Kernel size ......
Read more >Kernel size can't be greater than actual input size
I have a data with depth = 3 and I want to pass it through 3 convolution layers with 3x3x3 kernels each ...
Read more >An Introduction to different Types of Convolutions in Deep ...
Kernel Size : The kernel size defines the field of view of the convolution. A common choice for 2D is 3 — that...
Read more >Which one is better in CNN, smaller input size or ... - Quora
Very small filter sizes will capture very fine details of the image. On the other hand having a bigger filter size will leave...
Read more >Inception-v3报错:RuntimeError: Calculated padded input ...
Kernel size can't be greater than actual input size报错原因是我混用了 ... RuntimeError: Calculated padded input size per channel: (3 x 3).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Although in the documentation is said that “It is up to the user to add the proper padding”, it is quite tedious to calculate for each layer the proper padding. At least in PyTorch 1.4.0, the problem actually comes from
torch/nn/modules/conv.py#L341
. However, learning by PyTorch 1.5, https://github.com/pytorch/pytorch/blob/0475d7b08d7cba11fc0b3ea7ccbf0046fa0b1cf7/torch/nn/functional.py there is a function_pad
used at https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/conv.py#L342 that can be used to solve the problem in PyTorch 1.4 as well, In PyTorch 1.4.0 this function is calledpad
at line 2802 of the correspondingfunctional.py
file.Note that PyTorch 1.4.0 is the latest stable release, at least for Anaconda( April 6 2020). Additionally, the documentation is neither clear how to pad nor the
padding_mode
. Codetorch/nn/modules/conv.py#L341
,/home/bill/anaconda3/envs/py36/lib/python3.6/site-packages/torch/nn/functional.py#L2802
sheds some light on this. Nonetheless, further clarification is needed about the available options of padding. I have opened #36089 about this.@Michacal I guess you already have got a answer. There is a answer in #373
You should add padding to the second convolution layer. In model.py change line 137 to: