捷徑

torch.bitwise_left_shift

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

計算 input 左移 other 位元的算術位移。輸入張量必須是整數類型。此運算符支援廣播到一個共同的形狀類型提升

所應用的操作是

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

  • other (Tensor純量) – 第二個輸入張量

關鍵字參數

out (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 的完整開發人員文件

檢視文件

教學

取得針對初學者和進階開發人員的深入教學

檢視教學

資源

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

檢視資源