FilesLast commitLast update
19 days ago
19 days ago
2 months ago
3 days ago
3 days ago
19 days ago
19 days ago
19 days ago
17 days ago
README

Threshold

English | 简体中文

Applicable Products

Product Support
Ascend 950PR&950DT products √
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products ×
Atlas inference products ×
Atlas training products √

Function

  • Operator function: Performs the threshold operation on the input x. When the elements in x are greater than threshold, the operator returns 1. Otherwise, it returns 0.

  • Formula:

y=(x>threshold)  ?  1:0y = (x > threshold) \; ? \; 1 : 0

Parameters

Parameter name Input/Output/Attribute Description Data type Data format
x Input Input parameter for the threshold computation, which is x in the formula. FLOAT, FLOAT16, BFLOAT16 ND
y Output Output parameter after the threshold computation, which is y in the formula. FLOAT, FLOAT16, BFLOAT16 ND
threshold Attribute Threshold. Elements in x that are greater than this value output 1, and otherwise output 0. Default value: 0.0. FLOAT -

Constraints

  • The input and output are tensors of arbitrary dimensions (ND format).
  • The data types of the input and output must be consistent.
  • The output values are discrete values (0.0 or 1.0), which are bit-exact consistent with the Golden result.
  • A NaN input outputs 0.0 (NaN compared with any value is always False).
  • A +Inf input outputs 1.0 (+Inf > threshold is always True).
  • A -Inf input outputs 0.0 (-Inf > threshold is always False).

Invocation Description

Invocation method Invocation sample Description
Graph-mode invocation test_geir_threshold Calls the Threshold operator through graph construction with the operator IR.