Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.bitwise_left_shift function

PyTorch torch.bitwise_left_shift function

PyTorch torch.bitwise_left_shift function


PyTorch torch reference manual PyTorch torch reference manual

torch.bitwise_left_shift is a function in PyTorch used for element-wise left shift.

Function definition

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


Usage examples

Example

import

torch

Left shift example

x

=

torch.

tensor

(

[

1

,

2

,

3

,

4

]

,

dtype

=

torch.

int8

)

result

=

torch.

bitwise_left_shift

(

x

,

1

)

print

(

result

)

 

tensor([2, 4, 6, 8], dtype=int8)


PyTorch torch reference manual PyTorch torch reference manual