Returns a new tensor with the logarithm of the elements of input. The available logarithm functions are:

tch_log: Natural logarithm.

tch_log2: Base 2 logarithm.

tch_log10: Base 10 logarithm.

tch_log1p: Same as tch_log(1 + x). This function is more accurate than tch_log() for small values of x.

tch_log(x)

tch_log2(x)

tch_log10(x)

tch_log1p(x)

Arguments

x

tensor object

Examples

x <- tch_randn(c(2,2)) tch_log(x)
#> tensor #> nan -1.2291 #> 0.0796 nan #> [ Variable[CPUFloatType]{2,2} ]
tch_log2(x)
#> tensor #> nan -1.7732 #> 0.1148 nan #> [ Variable[CPUFloatType]{2,2} ]
tch_log10(x)
#> tensor #> nan -0.5338 #> 0.0346 nan #> [ Variable[CPUFloatType]{2,2} ]
tch_log1p(x)
#> tensor #> nan 0.2566 #> 0.7337 nan #> [ Variable[CPUFloatType]{2,2} ]