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局部重绘怎么让你省下80%的修图时间
人工智能
青春不败 177-3266-052013 小时前
基于Python实现的深度学习技术在水文水质领域应用
python·深度学习·机器学习·水文水资源·水质模型
中微极客13 小时前
从Prompt Engineering到RAG:LLM应用开发实战与性能优化全解析
人工智能·prompt
一次旅行13 小时前
AI 前沿日报 | 2026年07月25日
人工智能
lialaka13 小时前
「原味厨房(The Culinary Lab)」——全语音 3D AI 具身交互智能私人主厨与沉浸式烹饪陪伴交互舱
人工智能·交互
冬奇Lab13 小时前
AI 评测系列(05):Agent 评测——工具调用准确率与轨迹质量
人工智能·agent
阳光是sunny13 小时前
LangGraph高级教程:Multi Schema多状态管理详解
前端·人工智能·后端
CHrisFC13 小时前
环保第三方检测行业LIMS横向对比与选型指南
大数据·人工智能
阿童木写作13 小时前
Python批量翻译亚马逊商品图实战教程
开发语言·python·xcode