ExpSub(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

Subtracts src1 from src0, uses the difference as the exponent to compute the power of the natural constant e, and stores the result to dst.

If the source operands are of float type, the formula is as follows:

If the source operands are of half type, the formula is as follows:

For the Atlas 350 Accelerator Card:

Prototype

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

Parameters

Table 1 Template parameters

Parameter

Description

T

Data type of the destination operand.

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

U

Data type of the source operands.

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/src1

Input

Source operands.

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

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

count

Input

Number of elements involved in the computation.

Returns

None

Restrictions

Examples

1
AscendC::ExpSub(dstLocal, src0Local, src1Local, 512);
Result example:
Input (src0Local): [1 2 4 ... 510]
Input (src1Local): [1 1 2 ... 510]
Output (dstLocal): [1 2.71828 7.38905 ... 1]