快捷方式

torch.le

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

逐元素計算 inputother\text{input} \leq \text{other}

第二個引數可以是數值或張量,其形狀與第一個引數可廣播

引數
  • input (Tensor) – 待比較的張量

  • other (TensorScalar) – 待比較的張量或數值

關鍵字引數

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

返回

一個布林張量,在 input 小於或等於 other 的位置為 True,在其他位置為 False

示例

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

文件

訪問 PyTorch 的全面開發者文件

檢視文件

教程

獲取適合初學者和高階開發者的深入教程

檢視教程

資源

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

檢視資源