捷徑

torch.bitwise_right_shift

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

計算 input 算術右移 other 位元後的結果。輸入張量必須為整數類型。此運算子支援廣播到通用形狀類型提升。在任何情況下,如果右操作數的值為負數,或大於或等於提升後的左操作數中的位元數,則行為未定義。

應用的運算為

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

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

關鍵字參數

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

範例

>>> torch.bitwise_right_shift(torch.tensor([-2, -7, 31], dtype=torch.int8), torch.tensor([1, 0, 3], dtype=torch.int8))
tensor([-1, -7,  3], dtype=torch.int8)

文件

取得 PyTorch 的完整開發者文件

檢視文件

教學課程

取得針對初學者和進階開發者的深度教學課程

檢視教學課程

資源

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

檢視資源