Rate This Document
Findability
Accuracy
Completeness
Readability

kutacc_af2_triangle_multiplication_calc_proj

Calculate the intermediate values generated during triangle_multiplication, that is, left and right projections.

Interface Definition

void kutacc_af2_triangle_multiplication_calc_proj(kutacc_af2_tm_act_inputs_t *tm_acts_ptr, kutacc_tensor_h mask, kutacc_af2_tm_proj_weights_t *tm_weights_ptr, bool input_prepack);

Parameters

Table 1 Input parameter definition

Parameter

Type

Description

Input/Output

tm_acts_ptr

kutacc_af2_tm_act_inputs_t *

Pointer of the kutacc_af2_tm_act_inputs_t type. For details about the data structure, see Table 2.

Input

mask

kutacc_tensor_h

Mask tensor

Input

tm_weights_ptr

kutacc_af2_tm_proj_weights_t *

Pointer of the kutacc_af2_tm_proj_weights_t type. For details about the data structure, see Table 3.

Input

input_prepack

bool

Whether to perform the prepack operation on the input tensor

Input

Table 2 kutacc_af2_tm_act_inputs_t structure definition

Parameter

Type

Description

Input/Output

n_res

int64_t

Number of residues

Input

n_res_gather

int64_t

Number of residues

Input

proj_act

kutacc_tensor_h

Left and right projections of act

Output

input_act

kutacc_tensor_h

Value generated after the input act is normalized by LayerNorm

Input

proj_act_gate

kutacc_tensor_h

Temporary gating tensor

Input

Table 3 kutacc_af2_tm_proj_weights_t structure definition

Parameter

Type

Description

Input/Output

c_o

int64_t

Input feature dimension

Input

c_i

int64_t

Output feature dimension

Input

proj_w

kutacc_tensor_h

Weight required for projection generation

Input

proj_b

kutacc_tensor_h

Bias required for projection generation

Input

gate_w

kutacc_tensor_h

Gating weight

Input

gate_b

kutacc_tensor_h

Gating bias

Input

Constraints on integer parameters of triangle_multiplication:

n_res, n_res_gather, c_i, c_o > 0

n_res * n_res_gather < INT64_MAX

c_i = c_o

In single-process mode, n_res must be equal to n_res_gather. In multi-process mode, this condition does not need to be met.