PyTorch torch.exp2 function
PyTorch torch reference manual
torch.exp2 is a PyTorch function for computing powers of 2 element-wise.
Function definition
torch.exp2(input, *, out=None)
Usage examples
Example
import
torch
Power-of-2 example
x
=
torch.
tensor
(
[
0
,
1
,
2
,
3
,
4
]
,
dtype
=
torch.
float32
)
result
=
torch.
exp2
(
x
)
(
result
)