FilesLast commitLast update
5 months ago
3 months ago
2 months ago
2 months ago
2 months ago
2 months ago
5 months ago
1 month ago
9 days ago
README

ApproximateEqual

English | 简体中文

Product Support Status

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

Function Description

  • Operator function: determines element-wise whether two input tensors are approximately equal.

  • Computation formula:

    yi=∣x1i−x2i∣<tolerancey_i = |x1_i - x2_i| < tolerance

    where tolerance is a non-negative floating-point number, and the default value is 1e-5. The output is a tensor of the BOOL type, whose element values are true (approximately equal) or false (not approximately equal).

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x1 Input Input x1 in the formula. FLOAT, FLOAT16, BFLOAT16 ND
x2 Input Input x2 in the formula. Its data type and shape must be the same as those of x1. FLOAT, FLOAT16, BFLOAT16 ND
tolerance Optional attribute
  • Threshold for determining approximate equality.
  • The default value is 1e-5.
  • The value must be a non-negative finite floating-point number.
FLOAT -
y Output The element-wise comparison result. The shape is the same as that of x1. BOOL ND

Constraint Description

  • The data types of x1 and x2 must be the same. Implicit type conversion is not supported.
  • The shapes of x1 and x2 must be strictly equal. Broadcasting is not supported.
  • tolerance must be a non-negative finite floating-point number (NaN or Inf is not allowed).

Invocation Description

Invocation Method Invocation Sample Description
Graph-mode invocation test_geir_approximate_equal Invokes the ApproximateEqual operator by building a graph through the operator IR.