PyTorch torch.log2 function
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
)
(
result
)