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

Performs an element-wise negation on a tensor. The formula is as follows:

Prototype

1
2
template <typename T>
__aicore__ inline void Neg(const LocalTensor<T>& dst, const LocalTensor<T>& src, 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 int8_t, int16_t, half, int32_t, float, and int64_t.

Table 2 Parameters

Parameter

Input/Output

Description

dst

Output

Destination operand.

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

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

src

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.

The source operand must have the same data type as the destination operand.

count

Input

Number of elements involved in the computation.

Returns

None

Restrictions

Examples

For more examples, see LINK.

1
AscendC::Neg(dstLocal, srcLocal, 512);
Result example (both srcLocal and dstLocal are of the int64_t type):
1
2
Input (srcLocal): [1 2 3 4 ...]
Output (dstLocal): [-1 -2 -3 -4 ...]