This document is relevant for: Trn1, Trn2, Trn3
nki.language.exp#
- nki.language.exp(x, dtype=None)[source]#
Exponential of the input, element-wise.
((Similar to numpy.exp))
Warning
This API is experimental and may change in future releases.
The
exp(x)ise^xwhereeis the Euler’s number = 2.718281…- Parameters:
x – a tile.
dtype – (optional) data type to cast the output type to (see Supported Data Types for more information); if not specified, it will default to be the same as the data type of the input tile.
- Returns:
a tile that has exponential values of
x.
Examples:
import nki.language as nl # nki.language.exp -- exp(0.0) = 1.0 a = nl.full((128, 512), 0.0, dtype=nl.float32, buffer=nl.sbuf) b = nl.exp(a) expected = nl.full((128, 512), 1.0, dtype=nl.float32, buffer=nl.sbuf) assert nl.equal(b, expected)
This document is relevant for: Trn1, Trn2, Trn3