main() File "cls_set.py", line 50, in main output = model(input_var) File "/usr/local/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __._runtimeer">
当前位置:   article > 正文

Error:Given input size: (256x4x2). Calculated output size: (256x1x0). Output size is too small_runtimeerror: given input size: (128x5x5). calcula

runtimeerror: given input size: (128x5x5). calculated output size: (128x-22x
  1. Traceback (most recent call last):
  2. File "cls_set.py", line 62, in <module>
  3. main()
  4. File "cls_set.py", line 50, in main
  5. output = model(input_var)
  6. File "/usr/local/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
  7. result = self.forward(*input, **kwargs)
  8. File "/usr/local/lib64/python3.6/site-packages/torchvision/models/alexnet.py", line 45, in forward
  9. x = self.features(x)
  10. File "/usr/local/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
  11. result = self.forward(*input, **kwargs)
  12. File "/usr/local/lib64/python3.6/site-packages/torch/nn/modules/container.py", line 100, in forward
  13. input = module(input)
  14. File "/usr/local/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
  15. result = self.forward(*input, **kwargs)
  16. File "/usr/local/lib64/python3.6/site-packages/torch/nn/modules/pooling.py", line 141, in forward
  17. self.return_indices)
  18. File "/usr/local/lib64/python3.6/site-packages/torch/_jit_internal.py", line 181, in fn
  19. return if_false(*args, **kwargs)
  20. File "/usr/local/lib64/python3.6/site-packages/torch/nn/functional.py", line 488, in _max_pool2d
  21. input, kernel_size, stride, padding, dilation, ceil_mode)
  22. RuntimeError: Given input size: (256x4x2). Calculated output size: (256x1x0). Output size is too small

原因:图片太小,没有拉伸,进入网络后池化不够大

解决:修改了pooling层(网络结构改错了)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/149651
推荐阅读
相关标签
  

闽ICP备14008679号