from torch import nnclass Mnist_Logistic(nn.Module):def __init__(self):super().__init__()self.lin=nn.Linear(748,10)def forward(self,xb):return self.lin(xb)print(loss_func(model(xb),yb))

出现错误
size mismatch, m1: [64 x 784], m2: [748 x 10] at c:\a\w\1\s\windows\pytorch\aten\src\th\generic/THTensorMath.cpp:940
意思是说我输入的矩阵是64784
但是weights的矩阵是748
10
矩阵大小不匹配 不能相乘

修改

self.lin=nn.Linear(784,10)

pytorch RuntimeError: size mismatch, m1: [64 x 784], m2: [784 x 10] at相关推荐

  1. PyTorch RuntimeError: size mismatch, m1:

    在查看torch的FastRCNNPredictor官方实现时,想弄清楚一些细节,其中nn.Linear使用的时候需要给定(in_channels, num_classes). 随便打一点测试代码,报 ...

  2. RuntimeError: size mismatch, m1: [80 x 4], m2: [320 x 50] at ..\aten\src\TH/generic/THTensorMath.cpp

    RuntimeError: size mismatch, m1: [80 x 4], m2: [320 x 50] at -\aten\src\TH/generic/THTensorMath.cpp: ...

  3. RuntimeError: size mismatch, m1: [512 x 12800], m2: [2048 x 1024] at C

    RuntimeError: size mismatch, m1: [512 x 12800], m2: [2048 x 1024] at C 说一下这错误,意思就是m1和m2两个数组尺寸不一样. 为啥 ...

  4. pytorch搭建cnn报错:RuntimeError: size mismatch, m1: [10 x 43264], m2: [10816 x 2] at C...

    具体报错信息: Traceback (most recent call last):File "E:/Program Files/PyCharm 2019.2/machinelearning ...

  5. 做项目遇到问题 2 AWS NLP 剽窃RuntimeError: size mismatch, m1: [10 x 3], m2: [2 x 10]检测部署报错

    报错 RuntimeError: size mismatch, m1: [10 x 3], m2: [2 x 10] 原因: train.csv 为100x4    4列  第一列  标签是否剽窃  ...

  6. Pytorch-RuntimeError: size mismatch m1: [a x b], m2: [c x d]

    Pytorch-RuntimeError: size mismatch m1: [a x b], m2: [c x d] 在进行深度学习的代码中,在采用线性层进行转化的时候可能出现size misma ...

  7. 【error】RuntimeError: size mismatch与全连接fc层

    今天跑代码的时候遇到了这个错误: RuntimeError: size mismatch, m1:[1152 x 1] ,m2:[576 x 192] ,at /opt/conda/conda-bld ...

  8. RuntimeError: size mismatch

    RuntimeError: size mismatch出现于pytorch框架下加载VGG11预训练模型时出现的错误.笔者初期认为,出现该错误的主要原因是输出和输入的维度不匹配.带着疑惑,我们通过输出 ...

  9. 深度学习 cnn pytorch框架报错 size mismatch, m1: [ x ], m2: [ x ] Captcha.ImageCaptcha设置生成图片的大小尺寸

    看总结直接拉最后 这里很大程度是因为图片大小不一致,可以通过 resize命令来进行图片的归一化. 如果是通过captcha库里面的ImageCaptcha生成的验证码,百度上 没有任何资料说可以改变 ...

最新文章

  1. Commons-logging + Log4j 入门指南
  2. CTFshow php特性 web108
  3. 2.4.5 MySQL InnoDB重做与回滚介绍
  4. opera9.6 的一个顽固的bug
  5. linux编译运行build.sh,linux下libwebsockets编译及实例
  6. unsigned int + int型结果分析
  7. 安排!活动素材的亿级用户精准投放
  8. c++如何将两个if函数合并_Excel中的VLOOKUP函数,8种使用技巧与你分享
  9. iTOP-iMX6开发板-设备树内核-注册驱动例程
  10. Tips for vcpkg
  11. Android断点续传下载器JarvisDownloader
  12. [codeup 5038] 找零钱
  13. python下载第三方库失败的解决办法
  14. php fpm 504,php为什么会出现504错误
  15. ZUI datagrid 数据表格重新渲染问题
  16. 【北交所周报】北交所再迎8只新股;康普化学、凯华材料上市首日逆势大涨;康乐卫士过会,或成北交所最大IPO;北交所推出直联机制...
  17. 推荐几个 Go 圈子的高质量肝帝
  18. webpack基础篇(三):管理资源(image、css、fonts、csv、json5)
  19. javaee第一天作业
  20. C++链接器工具错误:LNK2001, LNK2019

热门文章

  1. python之json.loads()报错ValueError: No JSON object could be decoded解决
  2. android 背景毛玻璃模糊化效果实现方法
  3. 关于IOS时间格式显示问题
  4. MINIO(一)简介
  5. 第一章节: 光源种类介绍
  6. python-matplotlib-数据可视化-导入shp矢量数据并显示成图
  7. 重装系统找不到固态_SSD固态硬盘才装上确找不到盘怎么办 --好文
  8. 花式二维码生成,提供了 6 种样式
  9. 明辰智航网络一点通网络性能测试仪可以做什么
  10. 乐行学院Redis5学习教程 第一章redis5的安装