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)
相关推荐
GEO AI搜索优化助手21 分钟前
AI搜索革命:营销新纪元,GEO时代生成式AI重构搜索
人工智能·搜索引擎·生成式引擎优化·ai优化·geo搜索优化
赵长辉1 小时前
AGI-rag学习:ChromaDB使用1,txt类型文档【20251016课复习】
python·学习·llm·agi
丝瓜蛋汤1 小时前
NCE(noise contrastive estimation)loss噪声对比估计损失和InfoNCE loss
人工智能
DeepVis Research1 小时前
【AGI Safety/Robotics】2026年度 AGI 对抗性强化学习与软体机器人控制基准索引 (Skynet/Legion Core)
人工智能·网络安全·机器人·数据集·强化学习
じ☆冷颜〃5 小时前
分布式系统中网络技术的演进与异构融合架构(HFNA)
笔记·python·物联网·设计模式·架构·云计算
夜思红尘7 小时前
算法--双指针
python·算法·剪枝
人工智能训练7 小时前
OpenEnler等Linux系统中安装git工具的方法
linux·运维·服务器·git·vscode·python·ubuntu
Tipriest_7 小时前
torch训练出的模型的组成以及模型训练后的使用和分析办法
人工智能·深度学习·torch·utils
QuiteCoder8 小时前
深度学习的范式演进、架构前沿与通用人工智能之路
人工智能·深度学习
周名彥8 小时前
### 天脑体系V∞·13824D完全体终极架构与全域落地研究报告 (生物计算与隐私计算融合版)
人工智能·神经网络·去中心化·量子计算·agi