torch.minimum¶ torch.minimum(input, other, *, out=None) → Tensor¶ 計算 input 和 other 逐元素的最小值。 注意 如果比較的元素之一是 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])