目录

Tanh

Function Description

Performs logistic regression Tanh element-wise using the following formula, where PAR indicates the number of elements that can be processed by a vector unit in one iteration.

Function Prototype

template <typename T, bool isReuseSource = false>
__aicore__ inline void Tanh(const LocalTensor<T>& dstTensor, const LocalTensor<T>& srcTensor, const uint32_t calCount)

Parameters

Table 1 Template parameters

Parameter Description
T Operand data type. The supported data types are half and float.
isReuseSource Whether the source operand can be modified. This parameter is reserved. Pass the default value false.

Table 2 API parameters

Parameter Input/Output Description
dstTensor Output

Destination operand.

The type is LocalTensor, and the supported TPosition is VECIN, VECCALC, or VECOUT.

srcTensor Input

Source operand.

The type is LocalTensor, and the supported TPosition is VECIN, VECCALC, or VECOUT.

calCount Input Number of elements involved in the computation.

Return Value

None

Supported Models

Kirin 9020 series processors

Kirin 9030 series processors

Kirin X90 series processors

Restrictions

Calling Example

AscendC::TPipe pipe;
// calCount indicates the number of elements involved in the computing.
// Other processing is omitted.
AscendC::Tanh<T, false>(yLocal, xLocal, calCount);