Function: threshold()
threshold(
src,dst,thresholdVal):Tensor
Defined in: extensions/math.ts:125
Applies the element-wise threshold step function on a float32 source tensor and writes the result to a destination tensor.
Parameters
src
The input source tensor. Expected shape [d1, ..., dn] with data
type float32.
dst
The pre-allocated destination tensor to write the result to.
Expected shape [d1, ..., dn] matching src with data type float32.
thresholdVal
number
The threshold value above or equal to which elements are mapped to 1.0.
Returns
The destination tensor dst containing the threshold step output of
shape [d1, ..., dn] and data type float32.
Throws
With code INVALID_ARGUMENT if tensor shapes or
data types are invalid, RESOURCE_BUSY if a tensor is in use, or
RESOURCE_DISPOSED if either tensor was disposed.