本文簡要介紹python語言中 torch.amax
的用法。
用法:
torch.amax(input, dim, keepdim=False, *, out=None) → Tensor
out(Tensor,可選的) -輸出張量。
返回給定維度
dim
中input
張量的每個切片的最大值。注意
max
/min
和amax
/amin
之間的區別是:amax
/amin
支持多維縮減,amax
/amin
不返回索引,amax
/amin
在相等的值之間均勻分布梯度,而max(dim)
/min(dim)
僅將梯度傳播到源張量中的單個索引。
如果
keepdim
是True
,則輸出張量的大小與input
相同,但在維度dim
中它的大小為 1。否則,dim
被壓縮(參見torch.squeeze()
),導致輸出張量的維度少 1 個(或len(dim)
)。例子:
>>> a = torch.randn(4, 4) >>> a tensor([[ 0.8177, 1.4878, -0.2491, 0.9130], [-0.7158, 1.1775, 2.0992, 0.4817], [-0.0053, 0.0164, -1.3738, -0.0507], [ 1.9700, 1.1106, -1.0318, -1.0816]]) >>> torch.amax(a, 1) tensor([1.4878, 2.0992, 0.0164, 1.9700])
參數:
關鍵字參數:
相關用法
- Python PyTorch amin用法及代碼示例
- Python PyTorch aminmax用法及代碼示例
- Python PyTorch argsort用法及代碼示例
- Python PyTorch addmm用法及代碼示例
- Python PyTorch addmv用法及代碼示例
- Python PyTorch apply_effects_tensor用法及代碼示例
- Python PyTorch assert_close用法及代碼示例
- Python PyTorch angle用法及代碼示例
- Python PyTorch all_reduce用法及代碼示例
- Python PyTorch atanh用法及代碼示例
- Python PyTorch annotate用法及代碼示例
- Python PyTorch async_execution用法及代碼示例
- Python PyTorch argmax用法及代碼示例
- Python PyTorch atan用法及代碼示例
- Python PyTorch as_strided用法及代碼示例
- Python PyTorch acos用法及代碼示例
- Python PyTorch all_gather用法及代碼示例
- Python PyTorch avg_pool1d用法及代碼示例
- Python PyTorch asin用法及代碼示例
- Python PyTorch allreduce_hook用法及代碼示例
- Python PyTorch argmin用法及代碼示例
- Python PyTorch any用法及代碼示例
- Python PyTorch all_to_all用法及代碼示例
- Python PyTorch asinh用法及代碼示例
- Python PyTorch add用法及代碼示例
注:本文由純淨天空篩選整理自pytorch.org大神的英文原創作品 torch.amax。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。