This document is relevant for: Inf2
, Trn1
, Trn1n
nki.isa.reciprocal#
- nki.isa.reciprocal(data, dtype=None, mask=None, **kwargs)[source]#
Compute reciprocal of the input
data
tile. Uses Scalar Engine or Vector Engine based on the number of elements per partition indata
.Estimated instruction cost:
- if
N
>= 64: N
Scalar Engine cycles, whereN
is the number of elements per partition indata
.- else:
8*N
Vector Engine cycles, whereN
is the number of elements per partition indata
.
- Parameters:
data – the input 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.
mask – (optional) a compile-time constant predicate that controls whether/how this instruction is executed (see NKI API Masking for details)
- Returns:
an output tile of reciprocal computation
Example:
import neuronxcc.nki as nki import neuronxcc.nki.isa as nisa import neuronxcc.nki.language as nl ... x = nl.load(in_tensor[nl.mgrid[0:128, 0:512]]) y = nisa.reciprocal(x)
- if
This document is relevant for: Inf2
, Trn1
, Trn1n