Mod
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 the remainder of self divided by other.
-
Computation formula:
After the tensor self and the scalar or tensor other are broadcast into tensors of the same shape, Mod can be expressed by the following mathematical formula:
outi=selfi−trunc(selfiotheri)∗otheriout_{i} = self_{i} - trunc \left(\frac{self_{i}}{other_{i}}\right) * other_{i}
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| self | Input | Input parameter for the mod computation, which is self_i in the formula. | DOUBLE, BFLOAT16, FLOAT16, FLOAT32, INT32, INT64, INT8, UINT8 | ND |
| other | Input | Input parameter for the mod computation, which is other_i in the formula. | DOUBLE, BFLOAT16, FLOAT16, FLOAT32, INT32, INT64, INT8, UINT8 | ND |
| out | Output | Output parameter for the mod computation, which is out_i in the formula. | DOUBLE, BFLOAT16, FLOAT16, FLOAT32, INT32, INT64, INT8, UINT8 | ND |
Constraint Description
- The data types must satisfy the data type inference rules. The inferred data type must be within the range of supported data types.
- The shapes of self and other must satisfy the broadcast rules.
- Data with more than 8 dimensions is not supported.
Invocation Description
| Invocation Method | Sample Code | Description |
|---|---|---|
| aclnn API | test_aclnn_fmod_scalar | Invokes the Mod operator through the aclnnFmodScalar API. |
| aclnn API | test_aclnn_fmod_tensor | Invokes the Mod operator through the aclnnFmodTensor API. |