TopK - 10 vs 11#
Next section compares an older to a newer version of the same operator after both definition are converted into markdown text. Green means an addition to the newer version, red means a deletion. Anything else is unchanged.
- TopK10 → TopK11 +5 -23
TopK10 → TopK11
RENAMED
@@ -1 +1 @@
|
|
1
|
-
Retrieve the top-K
|
1
|
+
Retrieve the top-K elements along a specified axis. Given an input tensor of
|
2
2
|
shape [a_1, a_2, ..., a_n, r] and integer argument k, return two outputs:
|
3
3
|
-Value tensor of shape [a_1, a_2, ..., a_{axis-1}, k, a_{axis+1}, ... a_n]
|
4
4
|
which contains the values of the top k elements along the specified axis
|
5
5
|
-Index tensor of shape [a_1, a_2, ..., a_{axis-1}, k, a_{axis+1}, ... a_n] which
|
6
6
|
contains the indices of the top k elements (original indices from the input
|
7
7
|
tensor).
|
8
|
-
If "largest" is 1 (the default value) then the k largest elements are returned.
|
9
|
-
If "sorted" is 1 (the default value) then the resulting k elements will be sorted.
|
10
|
-
If "sorted" is 0, order of returned 'Values' and 'Indices' are undefined.
|
11
|
-
|
12
|
-
Given two equivalent values, this operator uses the indices along the axis
|
8
|
+
Given two equivalent values, this operator uses the indices along the axis as
|
13
9
|
a tiebreaker. That is, the element with the lower index will appear first.
|
14
10
|
**Attributes**
|
15
11
|
* **axis**:
|
12
|
+
Dimension on which to do the sort.
|
16
|
-
Dimension on which to do the sort. Negative value means counting
|
17
|
-
dimensions from the back. Accepted range is [-r, r-1] where r =
|
18
|
-
rank(input).
|
19
|
-
* **largest**:
|
20
|
-
Whether to return the top-K largest or smallest elements.
|
21
|
-
* **sorted**:
|
22
|
-
Whether to return the elements in sorted order.
|
23
13
|
**Inputs**
|
24
14
|
* **X** (heterogeneous) - **T**:
|
25
15
|
Tensor of shape [a_1, a_2, ..., a_n, r]
|
26
16
|
* **K** (heterogeneous) - **tensor(int64)**:
|
27
17
|
A 1-D tensor containing a single positive value corresponding to the
|
28
18
|
number of top elements to retrieve
|
29
19
|
**Outputs**
|
30
20
|
* **Values** (heterogeneous) - **T**:
|
31
21
|
Tensor of shape [a_1, a_2, ..., a_{axis-1}, k, a_{axis+1}, ... a_n]
|
32
22
|
containing top K values from the input tensor
|
33
23
|
* **Indices** (heterogeneous) - **I**:
|
34
24
|
Tensor of shape [a_1, a_2, ..., a_{axis-1}, k, a_{axis+1}, ... a_n]
|
35
25
|
containing the corresponding input tensor indices for the top K
|
36
26
|
values.
|
37
27
|
**Type Constraints**
|
38
28
|
* **T** in (
|
39
29
|
tensor(double),
|
40
30
|
tensor(float),
|
41
|
-
tensor(float16)
|
31
|
+
tensor(float16)
|
42
|
-
tensor(int16),
|
43
|
-
tensor(int32),
|
44
|
-
tensor(int64),
|
45
|
-
tensor(int8),
|
46
|
-
tensor(uint16),
|
47
|
-
tensor(uint32),
|
48
|
-
tensor(uint64),
|
49
|
-
tensor(uint8)
|
50
32
|
):
|
51
|
-
Constrain input and output types to
|
33
|
+
Constrain input and output types to float tensors.
|
52
34
|
* **I** in (
|
53
35
|
tensor(int64)
|
54
36
|
):
|
55
37
|
Constrain index tensor to int64
|