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