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)
相关推荐
暗夜猎手-大魔王13 小时前
转载--AI Agent 架构设计:记忆污染(OpenClaw、Claude Code、Hermes Agent 对比)
人工智能
2zcode13 小时前
面向健身与康复训练的基于深度学习的人体姿态检测与动作纠正系统
人工智能·深度学习·智能电视
HIT_Weston13 小时前
66、【Agent】【OpenCode】用户对话提示词(Agent 主动性)
人工智能·agent·opencode
Chengbei1113 小时前
轻量化 Web 安全日志分析神器 星川智盾日志威胁检测、地理溯源、MITRE ATT&CK 映射,支持 Windows/macOS/Linux
前端·人工智能·安全·web安全·macos·系统安全·安全架构
风流 少年13 小时前
Python Web框架:FastAPI
前端·python·fastapi
久菜盒子工作室13 小时前
中国工业气体行业研究报告(2026)
大数据·人工智能
GISer_Jing13 小时前
AI时代面试新常态——从“会用工具”到“深挖原理”的跨越
前端·人工智能·ai编程
Qres82113 小时前
Rabrg/artificial-life test
python·模拟
IT_陈寒13 小时前
React的useEffect把我坑惨了,这些闭包陷阱真要命
前端·人工智能·后端
财经资讯数据_灵砚智能13 小时前
基于全球经济类多源新闻的NLP情感分析与数据可视化(夜间-次晨)2026年5月1日
大数据·人工智能·python·信息可视化·自然语言处理