nki.language.sign — AWS Neuron Documentation (original) (raw)
This document is relevant for: Inf2
, Trn1
, Trn2
nki.language.sign#
nki.language.sign(x, *, dtype=None, mask=None, **kwargs)[source]#
Sign of the numbers of the input, element-wise.
((Similar to numpy.sign))
The sign function returns -1
if x < 0
, 0
if x==0
, 1
if x > 0
.
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.
- mask – (optional) a compile-time constant predicate that controls whether/how this instruction is executed (see NKI API Masking for details)
Returns:
a tile that has sign values of x
.
This document is relevant for: Inf2
, Trn1
, Trn2