exp_

Documentation

treetensor.torch.exp_(input)[source]

In-place version of exp().

Examples:

>>> import torch
>>> import treetensor.torch as ttorch
>>> t = ttorch.tensor([-4.0, -1.0, 0, 2.0, 4.8, 8.0])
>>> ttorch.exp_(t)
>>> t
tensor([1.8316e-02, 3.6788e-01, 1.0000e+00, 7.3891e+00, 1.2151e+02, 2.9810e+03])

>>> 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.exp_(t)
>>> t
<Tensor 0x7ff90a4bdb80>
├── a --> tensor([1.8316e-02, 3.6788e-01, 1.0000e+00, 7.3891e+00, 1.2151e+02, 2.9810e+03])
└── b --> <Tensor 0x7ff90a4bdc40>
    └── x --> tensor([[1.3534e-01, 3.3201e+00, 1.2840e+00],
                      [8.8861e+06, 4.2521e+01, 9.6328e-02]])

Torch Version Related

This documentation is based on torch.exp_ in torch v2.0.1+cu117. 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__)'