IsClose
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: returns a new tensor with Boolean elements, which indicates whether the given self and other are close to each other. If the values are close, it returns True; otherwise, it returns False.
-
Computation formula: Returns a new tensor out whose data type is BOOL, indicating whether each element of the input self is "close" to the corresponding element of the input other. closeness is defined as:
∣selfi−otheri∣≤atol+rtol×∣otheri∣\left | self_{i}-other_{i}\right | \le atol + rtol\times \left | other_{i} \right |
The preceding formula holds when both self and other are finite values. When both self and other are non-finite, the result is True only when they are equal. If equal_nan is True, NaNs are considered close; if equal_nan is False, NaNs are considered not close.
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| x1 | Input | Input parameter for the is_close computation, which is self_i in the formula. | BFLOAT16, FLOAT16, FLOAT, INT32 | ND |
| x2 | Input | Input parameter for the is_close computation, which is other_i in the formula. | BFLOAT16, FLOAT16, FLOAT, INT32 | ND |
| rtol | Input | Input parameter for the is_close computation, which is rtol in the formula. | FLOAT | ND |
| atol | Input | Input parameter for the is_close computation, which is atol in the formula. | FLOAT | ND |
| equal_nan | Input | Input parameter for the is_close computation. | BOOL | ND |
| y | Output | Output parameter for the is_close computation. | BOOL | ND |
Constraint Description
None
Invocation Description
| Invocation Method | Invocation Sample | Description |
|---|---|---|
| aclnn invocation | test_aclnn_isclose | Invokes the IsClose operator through the aclnnIsClose API. |