SetHF32

Function Description

Sets whether to enable the HF32 mode.

Prototype

1
__aicore__ inline void SetHF32(bool enableHF32 = false, int32_t transMode = 0)

Parameters

Parameter

Input/Output

Description

enableHF32

Input

Whether to enable the HF32 mode. The default value is false, indicating that the HF32 mode is disabled.

transMode

Input

ROUND mode used for converting float32 to hf32 when the HF32 mode is enabled. The default value is 0.

0: round mode is round to the nearest tie to even.

1: round mode is round to the nearest tie away from zero.

Returns

None

Availability

Precautions

None

Example

1
2
3
4
5
6
REGIST_MATMUL_OBJ(&pipe, GetSysWorkSpacePtr(), mm, &tiling);    // A/B/C/BIAS is of the float type.
mm.SetTensorA(gm_a);
mm.SetTensorB(gm_b);
mm.SetBias(gm_bias);
mm.SetHF32(true);
mm.IterateAll(gm_c);