exp¶
Documentation¶
-
treetensor.torch.
exp
(input, *args, **kwargs)[source]¶ Returns a new tensor with the exponential of the elements of the input tensor
input
.Examples:
>>> import torch >>> import treetensor.torch as ttorch >>> ttorch.exp(ttorch.tensor([-4.0, -1.0, 0, 2.0, 4.8, 8.0])) tensor([1.8316e-02, 3.6788e-01, 1.0000e+00, 7.3891e+00, 1.2151e+02, 2.9810e+03]) >>> ttorch.exp(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 0x7ff90a4b0a30> ├── a --> tensor([1.8316e-02, 3.6788e-01, 1.0000e+00, 7.3891e+00, 1.2151e+02, 2.9810e+03]) └── b --> <Tensor 0x7ff90a4b0af0> └── 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.4.1+cu121. 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 v2.4.1+cu121 is listed below.
Description From Torch v2.4.1+cu121¶
-
torch.
exp
(input, *, out=None) → Tensor¶ Returns a new tensor with the exponential of the elements of the input tensor
input
.\[y_{i} = e^{x_{i}}\]- Args:
input (Tensor): the input tensor.
- Keyword args:
out (Tensor, optional): the output tensor.
Example:
>>> torch.exp(torch.tensor([0, math.log(2.)])) tensor([ 1., 2.])