捷徑

torch.minimum

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

計算 inputother 逐元素的最小值。

注意

如果比較的元素之一是 NaN,則返回該元素。 minimum() 不支援具有複數 (complex) 資料型別的張量。

參數
  • input (Tensor) – 輸入張量。

  • other (Tensor) – 第二個輸入張量。

關鍵字參數

out (Tensor, optional) – 輸出張量 (可選)。

範例

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

文件

取得 PyTorch 的完整開發者文件

查看文件

教學

取得適合初學者和進階開發者的深入教學

查看教學

資源

尋找開發資源並獲得您的問題解答

查看資源