RpSort16

Applicability

Product

Supported

Atlas 350 Accelerator Card

x

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

x

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

Atlas inference product Vector Core

x

Atlas training product

Function Usage

Sorts the Region Proposals based on their score fields in descending order. 16 Region Proposals are sorted in each repeat.

Prototype

1
2
template <typename T>
__aicore__ inline void RpSort16(const LocalTensor<T>& dst, const LocalTensor<T>& src, const int32_t repeatTime)

Parameters

Table 1 Parameters in the template

Parameter

Description

T

Operand data type.

For the Atlas training product, the supported data type is half.

For the Atlas inference product AI Core, the supported data types are half and float.

Table 2 Parameters

Parameter

Input/Output

Meaning

dst

Output

Destination operand, which stores sorted Region Proposals.

The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT.

The start address of LocalTensor must be 32-byte aligned.

src

Input

Source operand, which stores unsorted Region Proposals.

The type is LocalTensor, and TPosition can be VECIN, VECCALC, or VECOUT.

The start address of LocalTensor must be 32-byte aligned.

repeatTime

Input

Number of iteration repeats. The value is of the int32_t type. 16 Region Proposals are sorted in each repeat. Value range: repeatTime ∈ [0,255]

Restrictions

  • Ensure that the numbers of Region Proposals stored in src and dst are greater than the required number of data elements. Otherwise, a tensor out-of-bounds error may occur
  • If the score values of proposal [i] and proposal [j] are the same and i is greater than j, proposal [j] is selected first.
  • For details about the operand address alignment requirements, see General Address Alignment Restrictions.

Examples

  • API usage example
    1
    2
    3
    4
    // ProposalConcat inserts consecutive elements into the corresponding positions within each Region Proposal.
    // repeatTime = 2. Sort the two Region Proposals. Since model is 4, the start position is 4.
    AscendC::ProposalConcat(dstLocal, srcLocal, 2, 4);
    AscendC::RpSort16(dstLocal, dstLocal, 2);
    
    Result example:
    Input (srcLocal):
    [ -1.624 -42.3   -54.12   91.25  -99.4    36.72   67.44  -66.3   -52.53
       3.377 -62.47  -15.85  -31.47    3.143  58.47  -83.75 21.58   63.47    
       7.234  35.16  -39.72   37.8    73.06  -98.7    44.1 -77.2    67.2    
       19.62  -87.9   -14.875  15.86  -77.75]
    dstLocal data after ProposalConcat. With the repeat of 2, compute 32 elements. Since the model is 4, the start position is 4.
    [  
     0.        0.      0.      0.
    -1.624     0.      0.      0.      0.      0.      0.      0.
    -42.3      0.      0.      0.      0.      0.      0.      0.
    -54.12     0.      0.      0.      0.      0.      0.      0.
    91.25      0.      0.      0.      0.      0.      0.      0.
    -99.4      0.      0.      0.      0.      0.      0.      0.
    36.72      0.      0.      0.      0.      0.      0.      0.
    67.44      0.      0.      0.      0.      0.      0.      0.
    -66.3      0.      0.      0.      0.      0.      0.      0.
    -52.53     0.      0.      0.      0.      0.      0.      0.
    3.377      0.      0.      0.      0.      0.      0.      0.
    -62.47     0.      0.      0.      0.      0.      0.      0.
    -15.85     0.      0.      0.      0.      0.      0.      0.
    -31.47     0.      0.      0.      0.      0.      0.      0.
    3.143      0.      0.      0.      0.      0.      0.      0.
    58.47      0.      0.      0.      0.      0.      0.      0.
    -83.75     0.      0.      0.      0.      0.      0.      0.
    21.58      0.      0.      0.      0.      0.      0.      0.
    63.47      0.      0.      0.      0.      0.      0.      0.
    7.234      0.      0.      0.      0.      0.      0.      0.
    35.16      0.      0.      0.      0.      0.      0.      0.
    -39.72     0.      0.      0.      0.      0.      0.      0.
    37.8       0.      0.      0.      0.      0.      0.      0.
    73.06      0.      0.      0.      0.      0.      0.      0.
    -98.7      0.      0.      0.      0.      0.      0.      0.
    44.1       0.      0.      0.      0.      0.      0.      0.
    -77.2      0.      0.      0.      0.      0.      0.      0.
    67.2       0.      0.      0.      0.      0.      0.      0.
    19.62      0.      0.      0.      0.      0.      0.      0.
    -87.9      0.      0.      0.      0.      0.      0.      0.
    -14.875    0.      0.      0.      0.      0.      0.      0.
    15.86      0.      0.      0.      0.      0.      0.      0.
    -77.75     0.      0.      0.     
    ]
    Output (dst_gm):
     [
     0.      0.      0.      0.
     91.25   0.      0.      0.      0.      0.      0.      0.
     67.44   0.      0.      0.      0.      0.      0.      0.
     58.47   0.      0.      0.      0.      0.      0.      0.
     36.72   0.      0.      0.      0.      0.      0.      0.
     3.377   0.      0.      0.      0.      0.      0.      0.
     3.143   0.      0.      0.      0.      0.      0.      0.
     -1.624  0.      0.      0.      0.      0.      0.      0.
     -15.85  0.      0.      0.      0.      0.      0.      0.
     -31.47  0.      0.      0.      0.      0.      0.      0.
     -42.3   0.      0.      0.      0.      0.      0.      0.
     -52.53  0.      0.      0.      0.      0.      0.      0.
     -54.12  0.      0.      0.      0.      0.      0.      0.
     -62.47  0.      0.      0.      0.      0.      0.      0.
     -66.3   0.      0.      0.      0.      0.      0.      0
     -83.75  0.      0.      0.      0.      0.      0.      0.
     -99.4   0.      0.      0.      0.      0.      0.      0.
     73.06   0.      0.      0.      0.      0.      0.      0.
     67.2    0.      0.      0.      0.      0.      0.      0.
     63.47   0.      0.      0.      0.      0.      0.      0.
     44.1    0.      0.      0.      0.      0.      0.      0.
     37.8    0.      0.      0.      0.      0.      0.      0.
     35.16   0.      0.      0.      0.      0.      0.      0.
     21.58   0.      0.      0.      0.      0.      0.      0.
     19.62   0.      0.      0.      0.      0.      0.      0.
     15.86   0.      0.      0.      0.      0.      0.      0.
     7.234   0.      0.      0.      0.      0.      0.      0.
     -14.875 0.      0.      0.      0.      0.      0.      0.
     -39.72  0.      0.      0.      0.      0.      0.      0.
     -77.2   0.      0.      0.      0.      0.      0.      0.
     -77.75  0.      0.      0.      0.      0.      0.      0.
     -87.9   0.      0.      0.      0.      0.      0.      0.
     -98.7   0.      0.      0.
     ]