快捷鍵

torch.gt

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

計算元素級的 input>other\text{input} > \text{other}

第二個引數可以是一個數字或一個張量,其形狀可以與第一個引數進行 廣播 (broadcast)

參數
  • input (Tensor) – 要比較的張量

  • other (Tensorfloat) – 要比較的張量或值

關鍵字參數

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

返回值

一個布林張量,當 input 大於 other 時為 True,否則為 False

範例

>>> torch.gt(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]))
tensor([[False, True], [False, False]])

文件

取得 PyTorch 的完整開發者文件

檢視文件

教學

取得適用於初學者和高級開發者的深入教學

檢視教學

資源

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

檢視資源