mat1 and mat2

RuntimeError: mat1 and mat2 shapes cannot be multiplied (64x640 and 128x128)

img


哪个老哥可以帮忙解决一下啊

  • 给你找了一篇非常好的博客,你可以看看是否有帮助,链接:RuntimeError: mat1 and mat2 shapes cannot be multiplied (5760x6 and 128x4)
  • 除此之外, 这篇博客: 2021-11-12中的 全连接层输入问题(RuntimeError: mat1 and mat2 shapes cannot be multiplied): 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • 问题展示:

    RuntimeError: mat1 and mat2 shapes cannot be multiplied (3822x1700 and 6497400x10)
    

    解决方案:
    参考:https://blog.csdn.net/qq_42079689/article/details/102873766
    问题出现原因是全连接层的输入是二维张量,输入数据需要进行一次转换。

    # edge_detect 维度1*3*1274*1700
    edge_detect1=edge_detect.view(1*1274*1700*3)
    # edge_detect1 维度6497400