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

PyTorch torch.log function

PyTorch torch.log function


PyTorch torch reference manual 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

]

)

print

(

torch.

log

(

x

)

)

The output is:

tensor([0., 1., 2.])


PyTorch torch reference manual PyTorch torch reference manual