log10

Documentation

treetensor.torch.log10(input, *args, **kwargs)[source]

Returns a new tensor with the logarithm to the base 10 of the elements of input.

Examples:

>>> import torch
>>> import treetensor.torch as ttorch
>>> ttorch.log10(ttorch.tensor([-4.0, -1.0, 0, 2.0, 4.8, 8.0]))
tensor([   nan,    nan,   -inf, 0.3010, 0.6812, 0.9031])

>>> ttorch.log10(ttorch.tensor({
...     'a': [-4.0, -1.0, 0, 2.0, 4.8, 8.0],
...     'b': {'x': [[-2.0, 1.2, 0.25],
...                 [16.0, 3.75, -2.34]]},
... }))
<Tensor 0x7ff90a4bc4f0>
├── a --> tensor([   nan,    nan,   -inf, 0.3010, 0.6812, 0.9031])
└── b --> <Tensor 0x7ff90a4bc5b0>
    └── x --> tensor([[    nan,  0.0792, -0.6021],
                      [ 1.2041,  0.5740,     nan]])

Torch Version Related

This documentation is based on torch.log10 in torch v1.9.0+cu102. Its arguments’ arrangements depend on the version of pytorch you installed.

If some arguments listed here are not working properly, please check your pytorch’s version with the following command and find its documentation.

1
python -c 'import torch;print(torch.__version__)'

The arguments and keyword arguments supported in torch v1.9.0+cu102 is listed below.

Description From Torch v1.9.0+cu102

torch.log10(input, *, out=None)Tensor

Returns a new tensor with the logarithm to the base 10 of the elements of input.

\[y_{i} = \log_{10} (x_{i})\]
Args:

input (Tensor): the input tensor.

Keyword args:

out (Tensor, optional): the output tensor.

Example:

>>> a = torch.rand(5)
>>> a
tensor([ 0.5224,  0.9354,  0.7257,  0.1301,  0.2251])


>>> torch.log10(a)
tensor([-0.2820, -0.0290, -0.1392, -0.8857, -0.6476])