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