TopK - 10 vs 11¶
- TopK10 → TopK11 +23 -5
TopK10 → TopK11
RENAMED
@@ -1 +1 @@
|
|
1
|
-
Retrieve the top-K elements along a specified axis. Given an input tensor of
|
1
|
+
Retrieve the top-K largest or smallest 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
|
+
|
8
|
-
Given two equivalent values, this operator uses the indices along the axis
|
12
|
+
Given two equivalent values, this operator uses the indices along the axis as
|
9
13
|
a tiebreaker. That is, the element with the lower index will appear first.
|
10
14
|
**Attributes**
|
11
15
|
* **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.
|
13
23
|
**Inputs**
|
14
24
|
* **X** (heterogeneous) - **T**:
|
15
25
|
Tensor of shape [a_1, a_2, ..., a_n, r]
|
16
26
|
* **K** (heterogeneous) - **tensor(int64)**:
|
17
27
|
A 1-D tensor containing a single positive value corresponding to the
|
18
28
|
number of top elements to retrieve
|
19
29
|
**Outputs**
|
20
30
|
* **Values** (heterogeneous) - **T**:
|
21
31
|
Tensor of shape [a_1, a_2, ..., a_{axis-1}, k, a_{axis+1}, ... a_n]
|
22
32
|
containing top K values from the input tensor
|
23
33
|
* **Indices** (heterogeneous) - **I**:
|
24
34
|
Tensor of shape [a_1, a_2, ..., a_{axis-1}, k, a_{axis+1}, ... a_n]
|
25
35
|
containing the corresponding input tensor indices for the top K
|
26
36
|
values.
|
27
37
|
**Type Constraints**
|
28
38
|
* **T** in (
|
29
39
|
tensor(double),
|
30
40
|
tensor(float),
|
31
|
-
tensor(float16)
|
41
|
+
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)
|
32
50
|
):
|
33
|
-
Constrain input and output types to
|
51
|
+
Constrain input and output types to numeric tensors.
|
34
52
|
* **I** in (
|
35
53
|
tensor(int64)
|
36
54
|
):
|
37
55
|
Constrain index tensor to int64
|