exp2

Documentation

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

Computes the base two exponential function of input.

Examples:

>>> import torch
>>> import treetensor.torch as ttorch
>>> ttorch.exp2(ttorch.tensor([-4.0, -1.0, 0, 2.0, 4.8, 8.0]))
tensor([6.2500e-02, 5.0000e-01, 1.0000e+00, 4.0000e+00, 2.7858e+01, 2.5600e+02])

>>> ttorch.exp2(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 0x7ff90a4c3af0>
├── a --> tensor([6.2500e-02, 5.0000e-01, 1.0000e+00, 4.0000e+00, 2.7858e+01, 2.5600e+02])
└── b --> <Tensor 0x7ff90a4c3be0>
    └── 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 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__)'

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

Description From Torch v1.10.0+cu102

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

Alias for torch.special.exp2().