快捷方式

torch.bitwise_right_shift

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

計算 inputother 位元位的右算術移位。輸入張量必須是整數型別。此運算子支援 廣播到公共形狀型別提升。在任何情況下,如果右運算元的值為負或大於等於提升後的左運算元的位元位數,則行為未定義。

應用的操作是

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

  • other (Tensor or 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 全面的開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並解答疑問

檢視資源