This document is relevant for: Trn2, Trn3
nki.language.is_finite#
- nki.language.is_finite(x, dtype=None)[source]#
Classify finite values element-wise using the Scalar Engine.
Supported on NeuronCore-v2 and newer. Returns numeric
1for finite values (including signed zero and subnormals) and0for infinities and NaNs.Input and output follow nki.isa.activation dtype constraints and need not be float32 or have matching dtypes. The Scalar Engine converts input to float32 for classification, then casts the
0/1result to the output dtype.- Parameters:
x – an input tile in SBUF or PSUM.
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 of numeric
0/1values with the shape ofx.
This document is relevant for: Trn2, Trn3