sqrt

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

x

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

x

Atlas inference product Vector Core

x

Atlas training product

x

Function Usage

Computes the square root of the input data.

Prototype

1
2
template <typename T>
__aicore__ inline T sqrt(const T src)

Parameters

Table 1 Template parameters

Parameter

Description

T

Data type of the input data src. Currently, the supported data types are float and int64_t.

Table 2 API parameters

Parameter

Input/Output

Description

src

Input

Source operand.

Restrictions

The input must be a non-negative number. If the input value is a negative number, the return value is meaningless.

Returns

Square root of the input data.

For data of the int64_t type, the calculation result is truncated to an integer.

Examples

1
2
3
4
int64_t src = 4;

int64_t result = AscendC::Std::sqrt(src); 
// result: 2