size mismatch, m1: [1 x 4962], m2: [20 x 120] at C:\w\1\s\windows\pytorch\aten\src\TH/generic/THTensorMath.cpp:136
时间: 2023-09-10 07:14:10 浏览: 207
pytorch逐元素比较tensor大小实例
这个错误是由于矩阵乘法中的尺寸不匹配导致的。错误信息中指出了两个矩阵的尺寸,m1的尺寸是[1 x 4962],m2的尺寸是[20 x 120]。在矩阵乘法中,第一个矩阵的列数必须与第二个矩阵的行数相同才能进行乘法运算。
要解决这个错误,你需要确保m1矩阵的列数与m2矩阵的行数相同。根据给定的错误信息,你可以看到m1矩阵的列数是4962,而m2矩阵的行数是20。因此,你需要将m1的列数修改为20,以使两个矩阵的尺寸匹配。这样就能够顺利进行矩阵乘法运算了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [RuntimeError: size mismatch, m1: [64 x 1008], m2: [1024 x 64] at ..\aten\src\TH/generic/THTensorMath](https://blog.csdn.net/weixin_44340927/article/details/129220178)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [leetcode不会-LeetCode_645--Set-Mismatch:LeetCode_645--Set-Mismatch](https://download.csdn.net/download/weixin_38602189/19922669)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [tasmanian-mismatch:分析来自基因组 DNA 的高通量测序数据中的伪影](https://download.csdn.net/download/weixin_42116921/20706454)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文