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)
相关推荐
其实防守也摸鱼8 分钟前
推荐一个自动化教育SRC漏洞挖掘系统--AutoHunter
运维·开发语言·人工智能·学习·安全·web安全·自动化
振浩微433射频芯片11 分钟前
从门锁到考勤,VRC522B如何在近场读卡场景中“稳坐C位”?
网络·人工智能·单片机·物联网
码视野12 分钟前
多宠 RFID 颈圈识别与湿粮半导体制冷保鲜分餐喂食器解决方案(软硬件一体化)
大数据·人工智能·python
未若君雅裁15 分钟前
让模型按契约返回数据,LangChain 结构化输出实战
python·langchain
九硕智慧建筑一体化厂家22 分钟前
智慧建筑高效管控!楼宇自控系统赋能新能源园区智能运维
运维·人工智能·笔记·智慧城市
2601_954526751 小时前
2026 生成式搜索引擎底层技术演进与 GEO优化服务商推荐:大模型检索增强(RAG)管道与语义对齐工程实战
大数据·人工智能·搜索引擎
我有满天星辰1 小时前
Spring AI Prompt 实战:System Prompt、User Prompt 与 PromptTemplate
人工智能·spring·prompt
A15362551 小时前
WMS 仓储管理系统推荐:企业如何选适配的仓储管理系统
大数据·人工智能
学习中.........1 小时前
Transformer 训练资源估算:以 CS336 GPT-2 XL 配置为例
人工智能·python·算法·机器学习·自然语言处理
Setsuna_F_Seiei6 小时前
前端的 AI 学习之路 02 之 Provider 与 Structured Output - 规范化模型输入输出
人工智能·agent·ai编程