当前位置:网站首页>torch.max()的用法
torch.max()的用法
2022-04-21 17:52:00 【燃烧吧哥们】
torch.max的用法
torch.max(Tensor,index)是求Tensor格式下的最大值包含两部分,一部分是最大值,另一部分是最大值的索引
a = torch.randn(3,3)
print(a)
>>tensor([[ 0.4538, -0.0595, 0.6461],
[-2.0434, 0.5453, -1.2888],
[ 0.6211, -0.7173, 0.2639]])
#每列的最大值以及最大值的索引
print(torch.max(a,0))
>>torch.return_types.max(
values=tensor([0.6211, 0.5453, 0.6461]),
indices=tensor([2, 1, 0]))
print(torch.max(a,0)[0])
>>tensor([0.6211, 0.5453, 0.6461])
print(torch.max(a,0)[1])
>>tensor([2, 1, 0])
#每行的最大值以及最大值的索引
print(torch.max(a,1))
>>torch.return_types.max(
values=tensor([0.6461, 0.5453, 0.6211]),
indices=tensor([2, 1, 0]))
print(torch.max(a,1)[0])
>tensor([0.6461, 0.5453, 0.6211])
print(torch.max(a,1)[1])
>tensor([2, 1, 0])
版权声明
本文为[燃烧吧哥们]所创,转载请带上原文链接,感谢
https://blog.csdn.net/hjkdh/article/details/124226045
边栏推荐
- SPI ServiceLoader.load()不生效
- Insight technology passed the "federal learning" product evaluation of the national financial technology evaluation center of the central bank in the first batch, realizing the dual certification of "
- Zhongang Mining: a new and active application field of fluorite resources
- Is it really safe to outsource model training? New research: outsourcers may implant backdoors to control bank lending
- 单片机diy作品鉴赏,初学者进来膜拜
- Shell编程学习(三)条件判断、流程控制
- Logstash ~ how logstash works
- The conflict between Russia and Ukraine raised concerns. The five eye network security department suggested that allies strengthen the protection of key infrastructure
- SQL命令 DELETE(一)
- AI+临床试验|拜耳探索创建“虚拟”对照组
猜你喜欢

Laxcus distributed operation redundancy and fault tolerance node

深耕行业数十年,多元视角解读!从思维转变看数字化转型 IT 经营
![[breakthrough in key and difficult points of C language] - dynamic memory management](/img/15/259705392c1363bdde0ca12331fee8.png)
[breakthrough in key and difficult points of C language] - dynamic memory management
本田北美产品规划发布!Insight混动停产,CR-V、雅阁即将发布

有奖征文 | 重奖5000元,邀您投稿

What is the difference between MOS tube and IGBT? Don't be silly and confused

Is it really safe to outsource model training? New research: outsourcers may implant backdoors to control bank lending

mysql汉化-workbench汉化-xml文件

【AI与食品】北工商中科院计算所最新《基于视觉分析的膳食评估》综述性论文

Considering loose coupling of microservice architecture? Be careful of these traps
随机推荐
动态规划:硬币题目总结
Akismet插件教程WordPress阻止过滤垃圾邮件插件
LogStash~LogStash的input(input)
每周推荐短视频:企业之间的竞争是看谁能抢占先机
STM32学习笔记——RTC的亚秒值校准
Variable ‘err‘ is accessed from within inner class, needs to be final or effectively final
终于完成学生时代的梦想-制作掌机用单片机STM32手把手教你
Analysis on the adaptation layer of openharmony UI framework (I)
用户发送请求到执行controller方法的过程发生了什么
Logstash ~ logstash command line optional parameters
Logstash ~ configuration file of logstash
Logstash ~ output of logstash
Onnx efficiency: comparison with module & dataparallel
Detailed explanation of spark SQL underlying execution process
LAXCUS分布式操作冗余容错之节点篇
Why do infrastructure engineers prefer MySQL?
Chest X-ray images - dataset
终于有人讲明白了!原来这才是全球低时延一张网技术
Logstash ~ input of logstash (input)
Query the employee information of non business department employees who joined in 2021. Comrades, how to write SQL statements and solve them