快捷方式

torch.bitwise_left_shift

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

計算 inputother 位進行的算術左移。輸入 Tensor 必須是整數型別。此運算子支援 廣播到共同形狀型別提升

應用的操作是

outi=inputi<<otheri\text{out}_i = \text{input}_i << \text{other}_i
引數
  • input (TensorScalar) – 第一個輸入 Tensor

  • other (TensorScalar) – 第二個輸入 Tensor

關鍵字引數

out (Tensor, 可選) – 輸出 Tensor。

示例

>>> torch.bitwise_left_shift(torch.tensor([-1, -2, 3], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8))
tensor([-2, -2, 24], dtype=torch.int8)

文件

查閱 PyTorch 的全面開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深入教程

檢視教程

資源

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

檢視資源