日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

torch.max

發布時間:2023/11/28 生活经验 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 torch.max 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

torch.max(input)?→ Tensor

返回輸入tensor中所有元素的最大值

a = torch.randn(1, 3)
>>0.4729 -0.2266 -0.2085

torch.max(a)
>>0.4729
?

?

torch.max(input,?dim,?keepdim=False,?out=None) -> (Tensor,?LongTensor)

按維度dim 返回最大值

torch.max)(a,0) 返回每一列中最大值的那個元素,且返回索引(返回最大元素在這一列的行索引)

a = torch.randn(3,3)
>>
0.2252 -0.0901 0.5663
-0.4694 0.8073 1.3596
0.1073 -0.7757 -0.8649

torch.max(a,0)
>>
(
0.2252
0.8073
1.3596
[torch.FloatTensor of size 3]
,
0
1
1
[torch.LongTensor of size 3]
)
torch.max(a,1) 返回每一行中最大值的那個元素,且返回其索引(返回最大元素在這一行的列索引)

a = torch.randn(3,3)
>>
0.2252 -0.0901 0.5663
-0.4694 0.8073 1.3596
0.1073 -0.7757 -0.8649

torch.max(a,1)
>>
(
0.5663
1.3596
0.1073
[torch.FloatTensor of size 3]
,
2
2
0
[torch.LongTensor of size 3]
)
torch.max()[0], 只返回最大值的每個數

troch.max()[1], 只返回最大值的每個索引

torch.max()[1].data 只返回variable中的數據部分(去掉Variable containing:)

torch.max()[1].data.numpy() 把數據轉化成numpy ndarry

torch.max()[1].data.numpy().squeeze() 把數據條目中維度為1 的刪除掉

torch.max(tensor1,tensor2) element-wise 比較tensor1 和tensor2 中的元素,返回較大的那個值
---------------------
作者:搖擺的果凍
來源:CSDN
原文:https://blog.csdn.net/Z_lbj/article/details/79766690
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!

總結

以上是生活随笔為你收集整理的torch.max的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。