SetFixPipeClipRelu

Supported Products

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

x

Atlas A2 training products/Atlas A2 inference products

x

Atlas 200I/500 A2 inference products

Atlas inference product's AI Core

x

Atlas inference product's Vector Core

x

Atlas training products

x

Function Usage

Sets the maximum value of the ClipReLU operation after real-time quantization is performed during DataCopy (CO1 -> GM).

ClipReLU is calculated as follows: min (clipReluMaxVal, srcData). clipReluMaxVal is the maximum value set by calling this API, and srcData is the source data.

Prototype

1
__aicore__ inline void SetFixPipeClipRelu(uint64_t config)

Parameters

Table 1 Parameters

Parameter

Input/Output

Meaning

config

Input

clipReluMaxVal, which is the maximum value of the ClipReLU operation. clipReluMaxVal occupies only 0-15 bits. It must be greater than 0 and cannot be INF/NAN.

Restrictions

When ReLU is enabled, the ReLU operation is performed before the ClipReLU operation.

Returns

None

Example

For details, see the complete example.

1
2
uint64_t clipReluMaxVal = 0x3c00; // value 1, convert half type to uint64_t type
SetFixPipeClipRelu(clipReluMaxVal);