zoukankan      html  css  js  c++  java
  • RuntimeError: size mismatch, m1: [32 x 2304], m2: [400 x 100] at C:/w/1/s/windows/pytorch/aten/srcTHC/generic/THCTensorMathBlas.cu:268

    这个错误一般是卷积和全连接直接对接的时候,大小不匹配导致的。

    可以查看卷积结束后 图片大小 ,然后对应修改全连接的输入大小即可。

        def forward(self,x):
            out = self.conv(x)
            out = out.view(out.size(0),-1)
            # print("-->{}".format(out.size()))
            out= self.fc(out)
            return out
    

      查看大小,然后修改自己的模型全连接的输入既可

  • 相关阅读:
    JS和Flash相互调用
    xml的应用
    随机验证码
    模块 time
    第一天 注册成功
    我的第一篇博客
    git
    2018-02-27
    25
    建站之星
  • 原文地址:https://www.cnblogs.com/blogwangwang/p/12002304.html
Copyright © 2011-2022 走看看