AdjacentDifference
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: compares the differences between adjacent elements of the input tensor. If two adjacent elements are the same, 0 is returned; otherwise, 1 is returned.
-
Computation formula:
outi=(xi==xj? 0:1).to(ydtype) j=i−1out_i = {(x_i == x_j ?\ 0 : 1)}.to(y_dtype) \ j = i - 1
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| x | Input | Input parameter for the AdjacentDifference computation, which is x in the formula. | FLOAT, FLOAT16, BFLOAT16, INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64 | ND |
| y_dtype | Input | An attribute that specifies the output type, which is y_dtype in the formula. | INT32 | ND |
| y | Output | Output parameter for the AdjacentDifference computation, which is out in the formula. | INT32, INT64 | ND |
- Atlas training products and Atlas inference products: BFLOAT16 is not supported.
Constraint Description
- None.
Invocation Description
| Invocation Method | Sample Code | Description |
|---|---|---|
| Graph mode | test_geir_adjacent_difference | Invokes the AdjacentDifference operator by building a graph through the operator IR. |