ScatterElements - 11 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.

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