Learn R Programming

rTorch (version 0.4.2)

log.torch.Tensor: Logarithm of a tensor given the tensor and the base

Description

Logarithm of a tensor given the tensor and the base

Usage

# S3 method for torch.Tensor
log(x, base = exp(1L))

Arguments

x

a tensor

base

the base of the logarithm

Examples

Run this code
# NOT RUN {
x <- torch$tensor(c(512, 1024, 2048, 4096))   # tensor([ 9., 10., 11., 12.])
base <- 2
log(x, base)

x <- torch$tensor(c(1, 10, 100, 1000))         # tensor([0., 1., 2., 3.])
log(x, 10)
# }

Run the code above in your browser using DataLab