Description: To improve performance, the inference network passes the sin and cos inputs through a cache to perform the rotary position encoding calculation.
Formula:
- mrope mode: The shape of the positions input is [3, numTokens]:
(1) rotate_half (GPT-NeoX style) computation formula:
(2) rotate_interleaved (GPT-J style) computation formula:
- Rope mode: The shape of the positions input is [numTokens]:
(1) rotate_half (GPT-NeoX style) computation formula:
(2) rotate_interleaved (GPT-J style) computation formula:
Each operator has calls. It is necessary to first call the [object Object] interface to obtain the required workspace size for computation and the executor that includes the operator's computation process. Then call the [object Object] interface to execute the computation.
Parameters:
[object Object]Returns:
[object Object]: status code. For details, see .The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]
Deterministic computation:
- aclnnNormRopeConcatBackward defaults to deterministic implementation.
[object Object],[object Object], and[object Object]only support 2-dimensional shape input.The data types of
[object Object],[object Object], and[object Object]inputs need to be consistent.[object Object]: When the data type is BFLOAT16 or FLOAT16, it should be a multiple of 32; when the data type is FLOAT32, it should be a multiple of 16.[object Object]: Always less than or equal to headSize; when the data type is BFLOAT16 or FLOAT16, it should be a multiple of 32, and when the data type is FLOAT32, it should be a multiple of 16; in mrope mode, it should satisfy rotaryDim = mropeSection[0] + mropeSection[1] + mropeSection[2].The value of the input tensor positions should be less than the
[object Object]of the 0th dimension of[object Object].[object Object](in mrope mode): the value is limited to [16, 24, 24], and the value of[object Object]is 128.
The following example is for reference only. For details, see .