Description: Perform the backward pass of the single-path rotary position encoding .
Formula:
In the forward pass of rotary position encoding, the axis list for broadcasting is
[object Object], and the computation formula can be expressed as follows:- [object Object]Atlas A3 training products/Atlas A3 inference products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]:
(1) Half mode (mode equals 0):
(2) Interleave mode (mode equals 1):
(3) Quarter mode (mode equals 2):
(4) Interleave-half mode (mode equals 3):
Each operator has calls. First call [object Object] to obtain the input parameters and calculate the required workspace size according to the process, and then call [object Object] to perform the computation.
Parameters
[object Object]- Parameter mode constraints:
- [object Object]Atlas A3 training products/Atlas A3 inference products[object Object] and [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: 0=half, 1=interleave.
- Parameter mode constraints:
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:
[object Object]defaults to deterministic implementation.[object Object]Atlas A3 training products/Atlas A3 inference products[object Object] and [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]:
- The input tensor
[object Object]supports BNSD, BSND, SBND, and TND layouts. - The D dimensions of the input tensors
[object Object],[object Object],[object Object],[object Object], and the output tensors[object Object],[object Object],[object Object]must be the same, satisfy D < 896, and must be a multiple of 2. - The shapes of the input tensors
[object Object],[object Object], and the output tensor[object Object]must be exactly the same. - The shapes of the input tensors
[object Object],[object Object]and the output tensors[object Object],[object Object]must be exactly the same, and the shapes of[object Object]and[object Object]must also be exactly the same. - Half mode:
- B, N < 1000; When calculating
[object Object]and[object Object], B * N <= 1024. - When
[object Object]is BNSD,[object Object]and[object Object]support 11SD, B1SD, and BNSD; when[object Object]and[object Object]are B1SD, the condition B < S must be satisfied. - When
[object Object]is BSND,[object Object]and[object Object]support 1S1D, BS1D, BSND; when[object Object]and[object Object]are BS1D, B < S must be satisfied. - When
[object Object]is SBND,[object Object]and[object Object]support S11D, SB1D, SBND. - When
[object Object]is TND,[object Object]and[object Object]support T1D and TND.
- B, N < 1000; When calculating
- Interleave mode:
- B * N < 1000 (N < 1000 when
[object Object]is TND). - When
[object Object]is BNSD,[object Object]and[object Object]support 11SD. - When
[object Object]is BSND,[object Object]and[object Object]support 1S1D. - When
[object Object]is SBND,[object Object]and[object Object]support S11D. - When
[object Object]is TND,[object Object]and[object Object]support T1D.
- B * N < 1000 (N < 1000 when
- The input tensor
The following example is for reference only. For details, see .