fn

exp2

Tensor
exp2(input: Tensor)
source

Element-wise base-2 exponential.

Computes 2x2^{x} for each entry of input.

Parameters

inputTensor
Input tensor.

Returns

Tensor

Element-wise result with the same shape as input.

Notes

Mathematical definition:

outi=2inputi\text{out}_i = 2^{\text{input}_i}

Gradient: 2xln22^{x} \ln 2.

Examples

>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0])
>>> lucid.exp2(x)
Tensor([...])