fn exp(self: @Tensor<T>) -> Tensor<T>;
Computes the exponential of all elements of the input tensor.
Constrain input and output types to fixed point tensors.
use core::array::{ArrayTrait, SpanTrait};
use orion::operators::tensor::{TensorTrait, Tensor, FP8x23Tensor};
use orion::numbers::{FP8x23, FixedTrait};
fn exp_example() -> Tensor<FP8x23> {
let tensor = TensorTrait::<FP8x23>::new(
shape: array![2, 2].span(),
data: array![
FixedTrait::new_unscaled(0, false),
FixedTrait::new_unscaled(1, false),
FixedTrait::new_unscaled(2, false),
FixedTrait::new_unscaled(3, false),
]
);
// We can call `exp` function as follows.
return tensor.exp();
}
>>> [[8388608,22802594],[61983844,168489688]]
// The fixed point representation of
// [[1, 2.718281],[7.38905, 20.085536]]