abs
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
Function Usage
Obtains the absolute value of the input data.
Prototype
1 2 | template <typename T> __aicore__ inline T abs(const T src) |
Parameters
Parameter |
Description |
|---|---|
T |
Data type of the input data src. Currently, the supported data types are int8_t, int16_t, int32_t, float, and int64_t. |
Parameter |
Input/Output |
Description |
|---|---|---|
src |
Input |
Source operand. |
Restrictions
None
Returns
Absolute value of the input data.
Examples
1 2 3 4 | int64_t src = -2; int64_t result = AscendC::Std::abs(src); // result: 2 |
Parent topic: Mathematical Functions