用户12833544
RuntimeError: 1D tensors expected, but got 2D and 2D tensors:矩阵乘法用 @ 或 matmul
原创
关注作者
腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
用户12833544
社区首页
>
专栏
>
RuntimeError: 1D tensors expected, but got 2D and 2D tensors:矩阵乘法用 @ 或 matmul
RuntimeError: 1D tensors expected, but got 2D and 2D tensors:矩阵乘法用 @ 或 matmul
用户12833544
关注
发布于 2026-11-21 23:22:11
发布于 2026-11-21 23:22:11
10
0
举报
概述
NumPy 的二维 dot 和 torch.dot 的接口语义不同。原题的两个输入均为二维矩阵且内维匹配时,应该使用矩阵乘法,而不是把矩阵强行展平。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系
cloudcommunity@tencent.com
删除。
pytorch
问题归档
专栏文章
快讯文章归档
关键词归档
开发者手册归档
开发者手册 Section 归档