exp2_¶
Documentation¶
-
treetensor.torch.
exp2_
(input)[source]¶ In-place version of
exp2()
.Examples:
>>> import torch >>> import treetensor.torch as ttorch >>> t = ttorch.tensor([-4.0, -1.0, 0, 2.0, 4.8, 8.0]) >>> ttorch.exp2_(t) >>> t tensor([6.2500e-02, 5.0000e-01, 1.0000e+00, 4.0000e+00, 2.7858e+01, 2.5600e+02]) >>> 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.exp2_(t) >>> t <Tensor 0x7ff90a4bd250> ├── a --> tensor([6.2500e-02, 5.0000e-01, 1.0000e+00, 4.0000e+00, 2.7858e+01, 2.5600e+02]) └── b --> <Tensor 0x7ff90a4bd130> └── x --> tensor([[2.5000e-01, 2.2974e+00, 1.1892e+00], [6.5536e+04, 1.3454e+01, 1.9751e-01]])
Torch Version Related
This documentation is based on torch.exp2_ 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__)' |