快捷方式

torch.maximum

torch.maximum(input, other, *, out=None) Tensor

計算 inputother 的逐元素最大值。

注意

如果比較的元素之一是 NaN,則返回該元素。具有複數 dtype 的 Tensor 不支援 maximum()

引數
  • input (Tensor) – 輸入 Tensor。

  • other (Tensor) – 第二個輸入 Tensor

關鍵字引數

out (Tensor, 可選) – 輸出 Tensor。

示例

>>> a = torch.tensor((1, 2, -1))
>>> b = torch.tensor((3, 0, 4))
>>> torch.maximum(a, b)
tensor([3, 2, 4])

文件

查閱 PyTorch 的全面開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深入教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源