ScatterElements - 16 vs 18#

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.

ScatterElements16 → ScatterElements18 RENAMED
@@ -1 +1 @@
1
1
  ScatterElements takes three inputs data, updates, and indices of the same
2
2
  rank r >= 1 and an optional attribute axis that identifies an axis of data
3
3
  (by default, the outer-most axis, that is axis 0). The output of the operation
4
4
  is produced by creating a copy of the input data, and then updating its value
5
5
  to values specified by updates at specific index positions specified by
6
6
  indices. Its output shape is the same as the shape of data.
7
-
8
7
  For each entry in updates, the target index in data is obtained by combining
9
8
  the corresponding entry in indices with the index of the entry itself: the
10
9
  index-value for dimension = axis is obtained from the value of the corresponding
11
10
  entry in indices and the index-value for dimension != axis is obtained from the
12
11
  index of the entry itself.
13
-
14
12
  reduction allows specification of an optional reduction operation, which is applied to all values in updates
15
13
  tensor into output at the specified indices.
16
14
  In cases where reduction is set to "none", indices should not have duplicate entries: that is, if idx1 != idx2,
17
15
  then indices[idx1] != indices[idx2]. For instance, in a 2-D tensor case, the update
18
16
  corresponding to the [i][j] entry is performed as below:
19
17
  ::
20
18
  output[indices[i][j]][j] = updates[i][j] if axis = 0,
21
19
  output[i][indices[i][j]] = updates[i][j] if axis = 1,
22
- When reduction is set to some reduction function f, the update corresponding to the [i][j] entry is performed as below:
20
+ When reduction is set to "add", the update corresponding to the [i][j] entry is performed as below:
23
21
  ::
24
- output[indices[i][j]][j] += f(output[indices[i][j]][j], updates[i][j]) if axis = 0,
22
+ output[indices[i][j]][j] += updates[i][j] if axis = 0,
25
- output[i][indices[i][j]] += f(output[i][indices[i][j]], updates[i][j]) if axis = 1,
23
+ output[i][indices[i][j]] += updates[i][j] if axis = 1,
24
+ When reduction is set to "mul", the update corresponding to the [i][j] entry is performed as below:
25
+ ::
26
+
27
+ output[indices[i][j]][j] *= updates[i][j] if axis = 0,
26
- where the f is +/*/max/min as specified.
28
+ output[i][indices[i][j]] *= updates[i][j] if axis = 1,
27
29
  This operator is the inverse of GatherElements. It is similar to Torch's Scatter operation.
28
-
29
- (Opset 18 change): Adds max/min to the set of allowed reduction ops.
30
-
31
30
  Example 1:
32
31
  ::
33
32
  data = [
34
33
  [0.0, 0.0, 0.0],
35
34
  [0.0, 0.0, 0.0],
36
35
  [0.0, 0.0, 0.0],
37
36
  ]
38
37
  indices = [
39
38
  [1, 0, 2],
40
39
  [0, 2, 1],
41
40
  ]
42
41
  updates = [
43
42
  [1.0, 1.1, 1.2],
44
43
  [2.0, 2.1, 2.2],
45
44
  ]
46
45
  output = [
47
46
  [2.0, 1.1, 0.0]
48
47
  [1.0, 0.0, 2.2]
49
48
  [0.0, 2.1, 1.2]
50
49
  ]
51
50
  Example 2:
52
51
  ::
53
52
  data = [[1.0, 2.0, 3.0, 4.0, 5.0]]
54
53
  indices = [[1, 3]]
55
54
  updates = [[1.1, 2.1]]
56
55
  axis = 1
57
56
  output = [[1.0, 1.1, 3.0, 2.1, 5.0]]
58
57
  **Attributes**
59
58
  * **axis**:
60
59
  Which axis to scatter on. Negative value means counting dimensions
61
60
  from the back. Accepted range is [-r, r-1] where r = rank(data).
62
61
  * **reduction**:
63
- Type of reduction to apply: none (default), add, mul, max, min.
62
+ Type of reduction to apply: none (default), add, mul. 'none': no
64
- 'none': no reduction applied. 'add': reduction using the addition
63
+ reduction applied. 'add': reduction using the addition operation.
65
- operation. 'mul': reduction using the multiplication
64
+ 'mul': reduction using the multiplication operation.
66
- operation.'max': reduction using the maximum operation.'min':
67
- reduction using the minimum operation.
68
65
  **Inputs**
69
66
  * **data** (heterogeneous) - **T**:
70
67
  Tensor of rank r >= 1.
71
68
  * **indices** (heterogeneous) - **Tind**:
72
69
  Tensor of int32/int64 indices, of r >= 1 (same rank as input). All
73
70
  index values are expected to be within bounds [-s, s-1] along axis
74
71
  of size s. It is an error if any of the index values are out of
75
72
  bounds.
76
73
  * **updates** (heterogeneous) - **T**:
77
74
  Tensor of rank r >=1 (same rank and shape as indices)
78
75
  **Outputs**
79
76
  * **output** (heterogeneous) - **T**:
80
77
  Tensor of rank r >= 1 (same rank as input).
81
78
  **Type Constraints**
82
79
  * **T** in (
83
80
  tensor(bfloat16),
84
81
  tensor(bool),
85
82
  tensor(complex128),
86
83
  tensor(complex64),
87
84
  tensor(double),
88
85
  tensor(float),
89
86
  tensor(float16),
90
87
  tensor(int16),
91
88
  tensor(int32),
92
89
  tensor(int64),
93
90
  tensor(int8),
94
91
  tensor(string),
95
92
  tensor(uint16),
96
93
  tensor(uint32),
97
94
  tensor(uint64),
98
95
  tensor(uint8)
99
96
  ):
100
97
  Input and output types can be of any tensor type.
101
98
  * **Tind** in (
102
99
  tensor(int32),
103
100
  tensor(int64)
104
101
  ):
105
102
  Constrain indices to integer types