pytorch@操作符

bash 复制代码
import torch

# Define two tensors (matrices)
A = torch.tensor([[1, 2], [3, 4]])
B = torch.tensor([[5, 6], [7, 8]])

# Perform matrix multiplication using @ operator
C = A @ B

print(C)

print(torch.matmul(A,B))

print(torch.mm(A,B))

example2

bash 复制代码
import torch
import numpy as np 
m = 5
p = 3 
n = 4 

# Define two tensors (matrices)
A = torch.tensor(np.random.randn(m,p))
B = torch.tensor(np.random.randn(p,n))

# Perform matrix multiplication using @ operator
C = A @ B

print(C)

print(torch.matmul(A,B))

print(torch.mm(A,B))![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/7ed9ce4cada04ce7943a7c743316f461.png)
相关推荐
master33619 分钟前
AI领域常用名词的系统梳理
人工智能·ai
Spidermanbaout26 分钟前
Prompt-Engineering实战-2026年11月2日
人工智能·机器学习·ai·chatgpt·ai编程
卷无止境1 小时前
RAGFlow 项目全景报告:从文档解析引擎到 Agent 原生数据库
后端·python
阿里云大数据AI技术1 小时前
EMR Serverless StarRocks + DLF Paimon 多模态数据湖检索
人工智能
文青的青2 小时前
不写一行代码,用 WorkBuddy 搭建并上线个人静态博客
人工智能
IT_陈寒2 小时前
Redis连接池泄漏那次,我差点把生产环境搞崩了
前端·人工智能·后端
Dawson Zhu2 小时前
从空间 Scaling 到时间 Scaling
人工智能·语言模型·架构·aigc·agi
灿飞屋2 小时前
Kotlin与Java虚拟机三:控制流
android·java·开发语言·后端·python·kotlin·安卓
benchmark_cc2 小时前
单只股票五档盘口接入个人研究仓库:QuantDash 读取、校验与易错点
python·数据分析·pandas·量化交易·股票数据·quantdash
阿里云大数据AI技术2 小时前
本体如何落地?阿里云 Milvus 把企业文档变成知识图谱和 Wiki
人工智能