ScatterND - 11 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. ScatterND11 → ScatterND13 +0 -1
ScatterND11 → ScatterND13 RENAMED
@@ -1 +1 @@
1
1
  ScatterND takes three inputs data tensor of rank r >= 1, indices tensor of rank q >= 1,
2
2
  and updates tensor of rank q + r - indices.shape[-1] - 1. The output of the operation
3
3
  is produced by creating a copy of the input data, and then updating its value to values
4
4
  specified by updates at specific index positions specified by indices. Its output shape
5
5
  is the same as the shape of data. Note that indices should not have duplicate entries.
6
6
  That is, two or more updates for the same index-location is not supported.
7
7
  indices is an integer tensor. Let k denote indices.shape[-1], the last dimension in the shape of indices.
8
8
  indices is treated as a (q-1)-dimensional tensor of k-tuples, where each k-tuple is a partial-index into data.
9
9
  Hence, k can be a value at most the rank of data. When k equals rank(data), each update entry specifies an
10
10
  update to a single element of the tensor. When k is less than rank(data) each update entry specifies an
11
11
  update to a slice of the tensor.
12
12
  updates is treated as a (q-1)-dimensional tensor of replacement-slice-values. Thus, the
13
13
  first (q-1) dimensions of updates.shape must match the first (q-1) dimensions of indices.shape.
14
14
  The remaining dimensions of updates correspond to the dimensions of the
15
15
  replacement-slice-values. Each replacement-slice-value is a (r-k) dimensional tensor,
16
16
  corresponding to the trailing (r-k) dimensions of data. Thus, the shape of updates
17
17
  must equal indices.shape[0:q-1] ++ data.shape[k:r-1], where ++ denotes the concatenation
18
18
  of shapes.
19
19
  The output is calculated via the following equation:
20
20
  output = np.copy(data)
21
21
  update_indices = indices.shape[:-1]
22
22
  for idx in np.ndindex(update_indices):
23
23
  output[indices[idx]] = updates[idx]
24
24
  The order of iteration in the above loop is not specified.
25
25
  In particular, indices should not have duplicate entries: that is, if idx1 != idx2, then indices[idx1] != indices[idx2].
26
26
  This ensures that the output value does not depend on the iteration order.
27
27
  This operator is the inverse of GatherND.
28
28
  Example 1:
29
29
  ::
30
30
  data = [1, 2, 3, 4, 5, 6, 7, 8]
31
31
  indices = [[4], [3], [1], [7]]
32
32
  updates = [9, 10, 11, 12]
33
33
  output = [1, 11, 3, 10, 9, 6, 7, 12]
34
34
  Example 2:
35
35
  ::
36
36
  data = [[[1, 2, 3, 4], [5, 6, 7, 8], [8, 7, 6, 5], [4, 3, 2, 1]],
37
37
  [[1, 2, 3, 4], [5, 6, 7, 8], [8, 7, 6, 5], [4, 3, 2, 1]],
38
38
  [[8, 7, 6, 5], [4, 3, 2, 1], [1, 2, 3, 4], [5, 6, 7, 8]],
39
39
  [[8, 7, 6, 5], [4, 3, 2, 1], [1, 2, 3, 4], [5, 6, 7, 8]]]
40
40
  indices = [[0], [2]]
41
41
  updates = [[[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]],
42
42
  [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3], [4, 4, 4, 4]]]
43
43
  output = [[[5, 5, 5, 5], [6, 6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8]],
44
44
  [[1, 2, 3, 4], [5, 6, 7, 8], [8, 7, 6, 5], [4, 3, 2, 1]],
45
45
  [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3], [4, 4, 4, 4]],
46
46
  [[8, 7, 6, 5], [4, 3, 2, 1], [1, 2, 3, 4], [5, 6, 7, 8]]]
47
47
  **Inputs**
48
48
  * **data** (heterogeneous) - **T**:
49
49
  Tensor of rank r >= 1.
50
50
  * **indices** (heterogeneous) - **tensor(int64)**:
51
51
  Tensor of rank q >= 1.
52
52
  * **updates** (heterogeneous) - **T**:
53
53
  Tensor of rank q + r - indices_shape[-1] - 1.
54
54
  **Outputs**
55
55
  * **output** (heterogeneous) - **T**:
56
56
  Tensor of rank r >= 1.
57
57
  **Type Constraints**
58
58
  * **T** in (
59
- tensor(bfloat16),
60
59
  tensor(bool),
61
60
  tensor(complex128),
62
61
  tensor(complex64),
63
62
  tensor(double),
64
63
  tensor(float),
65
64
  tensor(float16),
66
65
  tensor(int16),
67
66
  tensor(int32),
68
67
  tensor(int64),
69
68
  tensor(int8),
70
69
  tensor(string),
71
70
  tensor(uint16),
72
71
  tensor(uint32),
73
72
  tensor(uint64),
74
73
  tensor(uint8)
75
74
  ):
76
75
  Constrain input and output types to any tensor type.