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 小时前
TVA 本质内涵与核心特征(系列)
人工智能·python·智能体视觉
澹锦汐13 小时前
AI 创意画板:生成按钮之前,先设计可撤销的创作过程
人工智能
邵宇然13 小时前
计算图优化的编译器视角:AI 推理引擎的算子融合与内存布局重构
人工智能
云雾J视界13 小时前
SST:高频变压器设计实战:铁氧体 vs 纳米晶 vs 非晶,磁性材料怎么选
python·acdc·dab·sst
中微极客13 小时前
KoMA:基于知识驱动的多智能体LLM自动驾驶框架深度解析
人工智能·机器学习·自动驾驶
Imagination官方博客13 小时前
边缘AI处理器的架构创新
人工智能·架构·gpu算力
我是谁??13 小时前
AI Movie Studio —— 一个面向电影、电视剧、动漫、短剧的 Agent 化影视理解与自动解说平台
人工智能
第一程序员13 小时前
Rust trait 入门:把 AI 客户端抽象成可替换接口
python·rust·github
@蔓蔓喜欢你13 小时前
AI 辅助智能组件生成:从设计稿到可运行代码的工程化实践
人工智能·ai