log_¶
Documentation¶
-
treetensor.torch.
log_
(input)[source]¶ In-place version of
log()
.Examples:
>>> import torch >>> import treetensor.torch as ttorch >>> t = ttorch.tensor([-4.0, -1.0, 0, 2.0, 4.8, 8.0]) >>> ttorch.log_(t) >>> t tensor([ nan, nan, -inf, 0.6931, 1.5686, 2.0794]) >>> t = 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]]}, ... }) >>> ttorch.log_(t) >>> t <Tensor 0x7ff90a4bdf70> ├── a --> tensor([ nan, nan, -inf, 0.6931, 1.5686, 2.0794]) └── b --> <Tensor 0x7ff90a4bdcd0> └── x --> tensor([[ nan, 0.1823, -1.3863], [ 2.7726, 1.3218, nan]])
Torch Version Related
This documentation is based on torch.log_ in torch v1.10.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__)' |