Prelu(ISASI)

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

Writes src0 to dst directly if src0 is greater than 0. Otherwise, writes the result of src0 × src1 to dst. The formula is as follows:

Prototype

1
2
template <typename T>
__aicore__ inline void Prelu(const LocalTensor<T>& dst, const LocalTensor<T>& src0, const LocalTensor<T>& src1, const uint32_t count)

Parameters

Table 1 Template parameters

Parameter

Description

T

Operand data type.

For the Atlas 350 Accelerator Card, the supported data types are half and float.

Table 2 Parameters

Parameter

Input/Output

Description

dst

Output

Destination operand.

The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT.

The start address of LocalTensor must be 32-byte aligned.

src0 and src1

Input

Source operand.

The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT.

The start address of LocalTensor must be 32-byte aligned.

Both source operands must have the same data type as the destination operand.

count

Input

Number of elements involved in the computation.

Returns

None

Restrictions

Examples

1
AscendC::Prelu(dstLocal, src0Local, src1Local, 512);
Result example:
Input (src0Local): [1 -2 -3 ... -512]
Input (src1Local): [513 -514 515 ... 1]
Output (dstLocal): [1 1024 -1045 ... -512]