Round
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
- Rounds the values of the input tensor to the nearest integer. If the value is equidistant from two integers, rounds to the even integer.
- Rounds the elements of the input tensor to the specified number of decimal places.
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| x | Input | Input tensor. | BFLOAT16, FLOAT16, FLOAT32, DOUBLE, INT32, INT64 | ND |
| decimals | Attribute | An optional integer attribute that specifies the number of decimal places to retain. The default value is 0. | INT | - |
| y | Output | Output tensor. | Same as the input tensor x | ND |
Constraint Description
- When the input value is in [-0.5, -0], the output value is 0.
- For scenarios where decimals is not 0: if the input data exceeds the range (-347000, 347000), the precision may be affected.
Invocation Description
| Invocation Method | Invocation Sample | Description |
|---|---|---|
| aclnn invocation | test_aclnn_round | Invokes the Round operator through the aclnnRound API |
| Graph-mode invocation | test_geir_round | Invokes the Round operator by building a graph through the operator IR. |