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