Gather - 1 vs 13#

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.

Files changed (1) hide show
  1. Gather1 → Gather13 +10 -22
Gather1 → Gather13 RENAMED
@@ -1 +1 @@
1
1
  Given data tensor of rank r >= 1, and indices tensor of rank q, gather
2
2
  entries of the axis dimension of data (by default outer-most one as axis=0) indexed by indices, and concatenates
3
3
  them in an output tensor of rank q + (r - 1).
4
+ Example 1:
4
-
5
- axis = 0 :
6
-
7
- Let
8
- k = indices[i_{0}, ..., i_{q-1}]
9
- Then
10
- output[i_{0}, ..., i_{q-1}, j_{0}, ..., j_{r-2}] = input[k , j_{0}, ..., j_{r-2}]
11
-
12
5
  ::
13
6
  data = [
14
7
  [1.0, 1.2],
15
8
  [2.3, 3.4],
16
9
  [4.5, 5.7],
17
10
  ]
18
11
  indices = [
19
12
  [0, 1],
20
13
  [1, 2],
21
14
  ]
22
15
  output = [
23
16
  [
24
17
  [1.0, 1.2],
25
18
  [2.3, 3.4],
26
19
  ],
27
20
  [
28
21
  [2.3, 3.4],
29
22
  [4.5, 5.7],
30
23
  ],
31
24
  ]
25
+ Example 2:
32
- axis = 1 :
33
-
34
- Let
35
- k = indices[i_{0}, ..., i_{q-1}]
36
- Then
37
- output[j_{0}, i_{0}, ..., i_{q-1}, j_{1}, ..., j_{r-2}] = input[j_{0}, k, j_{1}, ..., j_{r-2}]
38
-
39
26
  ::
40
27
  data = [
41
28
  [1.0, 1.2, 1.9],
42
29
  [2.3, 3.4, 3.9],
43
30
  [4.5, 5.7, 5.9],
44
31
  ]
45
32
  indices = [
46
33
  [0, 2],
47
34
  ]
48
35
  axis = 1,
49
36
  output = [
37
+ [
50
- [[1.0, 1.9]],
38
+ [1.0, 1.9],
51
- [[2.3, 3.9]],
39
+ [2.3, 3.9],
52
- [[4.5, 5.9]],
40
+ [4.5, 5.9],
41
+ ],
53
42
  ]
54
43
  **Attributes**
55
44
  * **axis**:
56
45
  Which axis to gather on. Negative value means counting dimensions
57
- from the back. Accepted range is [-r, r-1] where r = rank(data).
46
+ from the back. Accepted range is [-r, r-1]
58
47
  **Inputs**
59
48
  * **data** (heterogeneous) - **T**:
60
49
  Tensor of rank r >= 1.
61
50
  * **indices** (heterogeneous) - **Tind**:
62
51
  Tensor of int32/int64 indices, of any rank q. All index values are
63
- expected to be within bounds [-s, s-1] along axis of size s. It is
52
+ expected to be within bounds. It is an error if any of the index
64
- an error if any of the index values are out of bounds.
53
+ values are out of bounds.
65
54
  **Outputs**
66
55
  * **output** (heterogeneous) - **T**:
67
56
  Tensor of rank q + (r - 1).
68
57
  **Type Constraints**
69
58
  * **T** in (
70
- tensor(bfloat16),
71
59
  tensor(bool),
72
60
  tensor(complex128),
73
61
  tensor(complex64),
74
62
  tensor(double),
75
63
  tensor(float),
76
64
  tensor(float16),
77
65
  tensor(int16),
78
66
  tensor(int32),
79
67
  tensor(int64),
80
68
  tensor(int8),
81
69
  tensor(string),
82
70
  tensor(uint16),
83
71
  tensor(uint32),
84
72
  tensor(uint64),
85
73
  tensor(uint8)
86
74
  ):
87
75
  Constrain input and output types to any tensor type.
88
76
  * **Tind** in (
89
77
  tensor(int32),
90
78
  tensor(int64)
91
79
  ):
92
80
  Constrain indices to integer types