FilesLast commitLast update
23 days ago
1 month ago
15 days ago
4 months ago
1 month ago
14 days ago
README

RadixTopK

English | 简体中文

Product Support Status

Product Supported
Ascend 950PR&950DT products ×
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products ×
Atlas inference products ×
Atlas training products ×

Function Description

  • API function: returns the k extreme values and indices of the input tensor along the specified dimension. The RadixTopK operator supports specifying the value of k through an input tensor.

  • Computation description:

    • When largest=True, returns the k largest values and their indices along the specified dimension
    • When largest=False, returns the k smallest values and their indices along the specified dimension

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Input Input tensor for the TopK computation, supporting 1 to 8 dimensions. FLOAT16, BFLOAT16 ND
k Input 0D scalar tensor, indicating the number of extreme values output along the computation dimension. The value range is [0, x.size(dim)]. INT32, INT64 ND
values Output Output values of the TopK computation. The data type is the same as that of x. The sorting axis of the shape is the same as that of k, and non-sorting axes are the same as those of x. FLOAT16, BFLOAT16 ND
indices Output Output indices of the TopK computation. The data type is specified by the indices_dtype attribute. The sorting axis of the shape is the same as that of k, and non-sorting axes are the same as those of x. INT32, INT64 ND
sorted Attribute Optional Boolean. The default value is True. True indicates that the output results are sorted, and False indicates that the output results are not sorted. Bool -
dim Attribute Optional integer. The default value is -1. It indicates the computation dimension. The value range is [-x.dim(), x.dim()). Int -
largest Attribute Optional Boolean. The default value is True. True indicates that the k largest elements are returned, and False indicates that the k smallest elements are returned. Bool -
indices_dtype Attribute Optional integer. The default value is DT_INT32(3). It indicates the data type of the output indices. DT_INT32(3) or DT_INT64(9) is supported. Int -

Constraint Description

  • This operator is implemented by selection. The output is the index order of the selected elements on the sorting axis, and orderliness is not guaranteed.