norm3df

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

Obtains the square root of the sum of squares of the input data a, b, and c (a2 + b2 + c2).

Prototype

1
inline float norm3df(float a, float b, float c)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

a

Input

Source operand.

b

Input

Source operand.

c

Input

Source operand.

Returns

Square root of a2 + b2 + c2.

  • If the square root of a2 + b2 + c2 exceeds the maximum range of float, the return value is inf.
  • If any one or more of a, b, and c are ±inf, the return value is inf.
  • If one or more of a, b, and c are nan and not ±inf, the return value is nan.

Restrictions

For SIMT programming, this API is not supported.

Header File to Be Included

To use this API, the simt_api/math_functions.h header file must be included.

1
#include "simt_api/math_functions.h"

Examples

For SIMD and SIMT programming:
1
2
3
4
5
__simt_vf__ __launch_bounds__(1024) inline void KernelNorm3d(__gm__ float* dst, __gm__ float* a, __gm__ float* b, __gm__ float* c) 
{
    int idx = threadIdx.x + blockIdx.x * blockDim.x;
    dst[idx] = norm3df(a[idx], b[idx], c[idx]);
}