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)
相关推荐
Code_Artist6 小时前
AI 终于学会写正确的汉字了?GPT Image 2.0 到底做对了什么?
人工智能·chatgpt·openai
程序员cxuan6 小时前
玩了一天 REA,我号快没了
人工智能·后端·程序员
阿里云大数据AI技术6 小时前
聚数成湖,以智驭行:卓驭如何构建移动物理 AI 的数据底座
人工智能·spark
卷无止境6 小时前
暗流与破局:AI时代的代码安全审查工具全景指南
后端·python
武子康7 小时前
150毫秒和2400毫秒:同一 Agent 任务的两种延迟
人工智能·后端·agent
暖心hebbie设计学习7 小时前
GitHub 热榜周报(10.19)|5 个把 AI 装回本地的开源项目:多 agent 控制台、本地语音、节点式生成(含技术看点)
人工智能·github
猪脚踏浪8 小时前
open webui 在docker容器里跑,并且是在内网断绝互联网的环境下。生成ppt
人工智能
海边捡石子8 小时前
FreeSWITCH 入门:把电话系统接入语音客服机器人
人工智能·后端
桃西西呀8 小时前
我把网关限流配置成每秒 100 请求,大促一来照样被打挂,还把别人也拖垮了
人工智能·llm·ai编程
武子康8 小时前
Agent 偏好记忆怎样确认写入:范围、版本与撤销的一个最小例
人工智能·后端·agent