torch.maximum¶
- torch.maximum(input, other, *, out=None) Tensor ¶
計算
input
和other
的元素級最大值。注意
如果正在比較的元素之一是 NaN,則返回該元素。
maximum()
不支援具有複數 dtype 的張量。- 參數 (Parameters)
- 關鍵字參數 (Keyword Arguments)
out (Tensor, optional) – 輸出張量 (the output tensor),可選 (optional)。
範例 (Example)
>>> a = torch.tensor((1, 2, -1)) >>> b = torch.tensor((3, 0, 4)) >>> torch.maximum(a, b) tensor([3, 2, 4])