pppLang/SKNet

RuntimeError: Given input size: (1024x4x4). Calculated output size: (1024x0x0). Output size is too small

Opened this issue · 1 comments

The following error occurred when I used cifiar-10 data to train SK network. Is it because the image size is too small (32 * 32)?

Traceback (most recent call last):
File "C:/Users/cs/Desktop/SKNet-PyTorch/SKNet-master/main.py", line 38, in
train_epoch(net, optimizer, train_loader, criterion, epoch, writer=writer)
File "C:\Users\cs\Desktop\SKNet-PyTorch\SKNet-master\train.py", line 12, in train_epoch
result = model(data)
File "C:\Anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "C:\Users\cs\Desktop\SKNet-PyTorch\SKNet-master\sknet.py", line 140, in forward
fea = self.pool(fea)
File "C:\Anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "C:\Anaconda\envs\pytorch\lib\site-packages\torch\nn\modules\pooling.py", line 551, in forward
self.padding, self.ceil_mode, self.count_include_pad, self.divisor_override)
RuntimeError: Given input size: (1024x4x4). Calculated output size: (1024x0x0). Output size is too small

Yes, I find the same problem.
The reason is that the output of self.stage_1 is actually 16x16 instead of 32x32. Try to make stride = 1 in sknet.py, line 106. That fixes the problem.