学无先后,达者为师

网站首页 编程语言 正文

RuntimeError:Given input size:(256x1x1). Calculated output size: (256x0x0).Output size is too small

作者:甘霖佳佳 更新时间: 2022-01-31 编程语言

在这里插入图片描述
RuntimeError: Given input size: (256x1x1). Calculated output size: (256x0x0). Output size is too small

1.初始网络模型

原始网络模型对于cifar10使用了六层卷积,且每层卷积后接一层池化。
池化大小为(2*2,stride=2)。

2.报错原因

图片尺寸太小(初始尺寸32323,而32=2^5,经过五层池化后尺寸就变为1),进入网络后池化不够大。

3.解决方法

①修改pooling层,步长变为1。
②减少pooling层,两层卷积后一层池化,池化一共3层。

修改成功,不报错了。

原文链接:https://blog.csdn.net/weixin_45928096/article/details/122387754

栏目分类
最近更新