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)
相关推荐
circuitsosk7 分钟前
大模型驱动的AI产品后端架构设计与实践
人工智能·python
飞凌嵌入式8 分钟前
性能翻倍·功耗减半!RK3572八核核心板,重构嵌入式计算新标杆
人工智能·嵌入式硬件·飞凌嵌入式
gnhpc19 分钟前
深耕工业智造!飞腾主板,让智慧城市发展更高效
人工智能·智慧城市
JackSparrow41414 分钟前
前端安全之JS混淆+请求加密+请求签名以提升爬虫难度
前端·javascript·后端·爬虫·python·安全
人工智能AI技术17 分钟前
从Prompt到Graph Engineering:企业多Agent五层AI工程演进全解析
人工智能
西西弗Sisyphus18 分钟前
部署模型的优化:图像标准化预处理从三步到一步乘加(2)
人工智能·机器学习·分类·训练·推理·imagenet
软糖姐姐22 分钟前
python eureka服务发现_python与consul 实现gRPC服务注册-发现
python·consul·grpc·服务注册·发现
zandy101131 分钟前
2026年,AI Agent搜索Skill推荐已经离不开底层架构
大数据·人工智能·架构
听雨入夜41 分钟前
zero.zhang
开发语言·python
小弥儿42 分钟前
GitHub今日热榜 | 2026-07-31:AI Agent工作流共享赛道升温
人工智能·学习·github