[object Object]

[object Object][object Object]undefined
[object Object]
  • Description: Perform single-channel rotary position encoding computation.

  • Formula:

    • [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):

    x1=x[...,:x.shape[1]//2]x1 = x[..., : x.shape[-1] // 2] x2=x[...,x.shape[1]//2:]x2 = x[..., x.shape[-1] // 2 :] x_rotate=torch.cat((x2,x1),dim=1)x\_rotate = torch.cat((-x2, x1), dim=-1) y=xcos+x_rotatesiny = x * cos + x\_rotate * sin

    (2) Interleave mode (mode equals 1):

    x1=x[...,::2].view(1,1)x1 = x[..., ::2].view(-1, 1) x2=x[...,1::2].view(1,1)x2 = x[..., 1::2].view(-1, 1) x_rotate=torch.cat((x2,x1),dim=1).view(x.shape[0],x.shape[1],x.shape[2],x.shape[3])x\_rotate = torch.cat((-x2, x1), dim=-1).view(x.shape[0], x.shape[1], x.shape[2], x.shape[3]) y=xcos+x_rotatesiny = x * cos + x\_rotate * sin

    (3) Quarter mode (mode equals 2):

    x1=x[...,:x.shape[1]//4]x1 = x[..., : x.shape[-1] // 4] x2=x[...,x.shape[1]//4:x.shape[1]//2]x2 = x[..., x.shape[-1] // 4 : x.shape[-1] // 2] x3=x[...,x.shape[1]//2:x.shape[1]//43]x3 = x[..., x.shape[-1] // 2 : x.shape[-1] // 4 * 3] x4=x[...,x.shape[1]//43:]x4 = x[..., x.shape[-1] // 4 * 3 :] x_rotate=torch.cat((x2,x1,x4,x3),dim=1)x\_rotate = torch.cat((-x2, x1, -x4, x3), dim=-1) y=xcos+x_rotatesiny = x * cos + x\_rotate * sin

    (4) interleave-half mode (mode equals 3), this mode first extracts the odd-positioned inputs to the first half and the even-positioned inputs to the second half, then performs the half processing:

    x1=x[...,::2]x1 = x[..., ::2] x2=x[...,1::2]x2 = x[..., 1::2] x_part1=torch.cat((x1,x2),dim=1)x\_part1 = torch.cat((x1, x2), dim=-1) x_part2=torch.cat((x2,x1),dim=1)x\_part2 = torch.cat((-x2, x1), dim=-1) y=x_part1cos+x_part2siny = x\_part1 * cos + x\_part2 * sin
[object Object]

Each operator has calls. You must 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.

[object Object]
[object Object]
[object Object]
  • Parameters:

    [object Object]
    • Parameter mode constraints:
      • [object Object]Atlas A3 training products/Atlas A3 inference products[object Object], [object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: 0=half, 1=interleave.
  • Returns:

    [object Object]: status code. For details, see .

    The first-phase API implements input parameter verification. The following errors may be thrown.

    [object Object]
[object Object]
  • Parameters:

    [object Object]
  • Returns:

    [object Object]: status code. For details, see .

[object Object]
  • Deterministic Computation:
    • [object Object] defaults to deterministic implementation.

    • [object Object]Atlas A3 training products/Atlas A3 inference products[object Object], [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-dimensional sizes of the input tensor [object Object], [object Object], [object Object], and output tensor [object Object] must be the same, satisfy D < 896, and must be a multiple of 2. The shapes of the input tensor [object Object] and the output tensor [object Object] must be exactly the same. The shapes of the input tensors [object Object] and [object Object] must be exactly the same.

      • Half mode:
        • B, N < 1000.
        • When [object Object] is BNSD, [object Object] and [object Object] support 11SD, B1SD, and BNSD.
          • When (D/2) % (32/inputDtypeSize) == 0, it must satisfy B N <= S 8.
          • When (D/2) % (32/inputDtypeSize) != 0, it must satisfy B N 2 <= (S + coreNum -1) / coreNum or D >= 80.
        • When [object Object] is BSND, [object Object] and [object Object] support 1S1D, BS1D, BSND.
        • 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.
      • Interleave mode:
        • B * N < 1000 (N<1000 when x 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.
[object Object]

The following example is for reference only. For details, see .

[object Object]