ProposalExtract

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

Extracts elements from corresponding positions in Region Proposals and rearranges them. In each iteration, 16 elements are extracted from 16 Region Proposals and arranged consecutively. The functionality of this API is the opposite of that of ProposalConcat.

Prototype

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

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.

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.

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

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

The source operand must have the same data type as the destination operand.

repeatTime

Input

Number of iteration repeats. The value is of the int32_t type. In each iteration, 16 elements are extracted from 16 Region Proposals and rearranged. The next group of 16 elements will be extracted from the next group of 16 Region Proposals in the next iteration. Value range: repeatTime ∈ [0,255]

modeNumber

Input

Extraction position. Value range: modeNumber ∈ [0,5]; data type: int32_t. Only the following configurations are supported:
  • 0: extracts from x1.
  • 1: extracts from y1.
  • 2: extracts from x2.
  • 3: extracts from y2.
  • 4: extracts from score.
  • 5: extracts from label.

Returns

None

Restrictions

  • Ensure that the number of Region Proposals stored in src is greater than or equal to the required number. Otherwise, tensor access violation occurs.
  • Ensure dst contains at least the required number of elements, or a tensor out-of-bounds error may occur.
  • For details about the operand address alignment requirements, see General Address Alignment Restrictions.

Examples

  • API usage example
    1
    2
    // repeatTime = 2, modeNumber = 4. Extract elements from the score fields in 32 Region Proposals and arrange them into 32 consecutive elements.
    AscendC::ProposalExtract(dstLocal, srcLocal, 2, 4);
    
    Result example:
    Input (src_gm):
    Since modeNumber is 4, the start position of the first element 33.3 is 4. Each Region Proposal occupies eight consecutive elements of the half or float type. The type used here is half. Elements extracted later are separated by eight elements. The repeat is 2, meaning that 16 elements are processed in each iteration, for a total of 32 elements.
    [ 0.      0.      0.      0. 
      33.3    0.      0.      0.      0.      0.      0.      0.
      67.56   0.      0.      0.      0.      0.      0.      0.
      68.5    0.      0.      0.      0.      0.      0.      0.
      -11.914 0.      0.      0.      0.      0.      0.      0.
      25.19   0.      0.      0.      0.      0.      0.      0.
      -72.8   0.      0.      0.      0.      0.      0.      0.
      11.79   0.      0.      0.      0.      0.      0.      0.
      -49.47  0.      0.      0.      0.      0.      0.      0.
      49.44   0.      0.      0.      0.      0.      0.      0.
      84.4    0.      0.      0.      0.      0.      0.      0.
      -14.36  0.      0.      0.      0.      0.      0.      0.
      45.97   0.      0.      0.      0.      0.      0.      0.
      52.47   0.      0.      0.      0.      0.      0.      0.
      -5.387  0.      0.      0.      0.      0.      0.      0.
      -13.12  0.      0.      0.      0.      0.      0.      0.
      -88.9   0.      0.      0.      0.      0.      0.      0.
      54.     0.      0.      0.      0.      0.      0.      0.
      -51.62  0.      0.      0.      0.      0.      0.      0.
     -20.67   0.      0.      0.      0.      0.      0.      0.
     59.56    0.      0.      0.      0.      0.      0.      0.
     35.72    0.      0.      0.      0.      0.      0.      0.
     -6.12    0.      0.      0.      0.      0.      0.      0.
     -39.4    0.      0.      0.      0.      0.      0.      0.
     -11.46   0.      0.      0.      0.      0.      0.      0.
     -7.066   0.      0.      0.      0.      0.      0.      0.
     30.23    0.      0.      0.      0.      0.      0.      0.
     -11.18   0.      0.      0.      0.      0.      0.      0.
     -35.84   0.      0.      0.      0.      0.      0.      0.
     -40.88   0.      0.      0.      0.      0.      0.      0.
     60.9     0.      0.      0.      0.      0.      0.      0.
     -73.3    0.      0.      0.      0.      0.      0.      0.
     38.47    0.      0.      0. 
     ]
    Output (dst_gm):
    [ 33.3    67.56   68.5   -11.914  25.19  -72.8    11.79  -49.47   49.44
      84.4   -14.36   45.97   52.47   -5.387 -13.12  -88.9    54.    -51.62
     -20.67   59.56   35.72   -6.12  -39.4   -11.46   -7.066  30.23  -11.18
     -35.84  -40.88   60.9   -73.3    38.47 ]