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

PyTorch torch.log2 function

PyTorch torch.log2 function


PyTorch torch reference manual PyTorch torch reference manual

torch.log2 is a function in PyTorch used to compute the logarithm base 2.

Function definition

torch.log2(input, out)


Usage examples

Example

import

torch

Compute the logarithm base 2

x

=

torch.

tensor

(

[

1

,

2

,

4

,

8

,

16

]

)

result

=

torch.

log2

(

x

)

print

(

result

)


PyTorch torch reference manual PyTorch torch reference manual