ScatterElements - 16 vs 18

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