PyTorch torch.log function
PyTorch torch reference manual
torch.log is a function in PyTorch used to compute the element-wise natural logarithm.
Function definition
torch.log(input, out=None)
Usage examples
Example
import
torch
x
=
torch.
tensor
(
[
1
,
torch.
e
,
torch.
e
**
2
]
)
(
torch.
log
(
x
)
)
The output is:
tensor([0., 1., 2.])