OneHot - 9 vs 11#
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.
- OneHot9 → OneHot11 +10 -17
OneHot9 → OneHot11
RENAMED
@@ -1 +1 @@
|
|
1
1
|
Produces a one-hot tensor based on inputs.
|
2
2
|
The locations represented by the index values in the 'indices' input tensor will have 'on_value'
|
3
3
|
and the other locations will have 'off_value' in the output tensor, where 'on_value' and 'off_value'
|
4
4
|
are specified as part of required input argument 'values', which is a two-element tensor of format
|
5
5
|
[off_value, on_value]. The rank of the output tensor will be one greater than the rank of the
|
6
6
|
input tensor. The additional dimension is for one-hot representation. The additional dimension will
|
7
7
|
be inserted at the position specified by 'axis'. If 'axis' is not specified then then additional
|
8
8
|
dimension will be inserted as the innermost dimension, i.e. axis=-1. The size of the additional
|
9
9
|
dimension is specified by required scalar input 'depth'. The type of the output tensor is the same
|
10
10
|
as the type of the 'values' input. Any entries in the 'indices' input tensor with values outside
|
11
|
-
the range [
|
11
|
+
the range [0, depth) will result in one-hot representation with all 'off_value' values in the
|
12
12
|
output tensor.
|
13
|
-
|
14
|
-
when axis = 0:
|
15
|
-
output[input[i, j, k], i, j, k] = 1 for all i, j, k and 0 otherwise.
|
16
|
-
|
17
|
-
when axis = -1:
|
18
|
-
output[i, j, k, input[i, j, k]] = 1 for all i, j, k and 0 otherwise.
|
19
13
|
**Attributes**
|
20
14
|
* **axis**:
|
21
15
|
(Optional) Axis along which one-hot representation in added.
|
22
16
|
Default: axis=-1. axis=-1 means that the additional dimension will
|
23
17
|
be inserted as the innermost/last dimension in the output tensor.
|
24
|
-
Negative value means counting dimensions from the back. Accepted
|
25
|
-
range is [-r-1, r] where r = rank(indices).
|
26
18
|
**Inputs**
|
27
19
|
* **indices** (heterogeneous) - **T1**:
|
28
|
-
Input tensor containing indices.
|
20
|
+
Input tensor containing indices. The values must be non-negative
|
29
|
-
tensor with values outside the range [-depth, depth-1] will result
|
30
|
-
in one-hot representation with all 'off_value' values in the output
|
31
|
-
|
21
|
+
integers. Any entries in the 'indices' input tensor with values
|
22
|
+
outside the range [0, depth) will result in one-hot representation
|
23
|
+
with all 'off_value' values in the output tensor.In case 'indices'
|
32
|
-
casted to int64 before
|
24
|
+
is of non-integer type, the values will be casted to int64 before
|
25
|
+
use.
|
33
26
|
* **depth** (heterogeneous) - **T2**:
|
34
27
|
Scalar specifying the number of classes in one-hot tensor. This is
|
35
28
|
also the size of the one-hot dimension (specified by 'axis'
|
36
29
|
attribute) added on in the output tensor. The values in the
|
37
|
-
'indices' input tensor are expected to be in the range [
|
30
|
+
'indices' input tensor are expected to be in the range [0, depth).
|
38
|
-
|
31
|
+
In case 'depth' is of non-integer type, it will be casted to int64
|
39
|
-
|
32
|
+
before use.
|
40
33
|
* **values** (heterogeneous) - **T3**:
|
41
34
|
Rank 1 tensor containing exactly two elements, in the format
|
42
35
|
[off_value, on_value], where 'on_value' is the value used for
|
43
36
|
filling locations specified in 'indices' input tensor, and
|
44
37
|
'off_value' is the value used for filling locations other than those
|
45
38
|
specified in 'indices' input tensor.
|
46
39
|
**Outputs**
|
47
40
|
* **output** (heterogeneous) - **T3**:
|
48
41
|
Tensor of rank one greater than input tensor 'indices', i.e.
|
49
42
|
rank(output) = rank(indices) + 1. The data type for the elements of
|
50
43
|
the output tensor is the same as the type of input 'values' is used.
|
51
44
|
**Type Constraints**
|
52
45
|
* **T1** in (
|
53
46
|
tensor(double),
|
54
47
|
tensor(float),
|
55
48
|
tensor(float16),
|
56
49
|
tensor(int16),
|
57
50
|
tensor(int32),
|
58
51
|
tensor(int64),
|
59
52
|
tensor(int8),
|
60
53
|
tensor(uint16),
|
61
54
|
tensor(uint32),
|
62
55
|
tensor(uint64),
|
63
56
|
tensor(uint8)
|
64
57
|
):
|
65
58
|
Constrain input to only numeric types.
|
66
59
|
* **T2** in (
|
67
60
|
tensor(double),
|
68
61
|
tensor(float),
|
69
62
|
tensor(float16),
|
70
63
|
tensor(int16),
|
71
64
|
tensor(int32),
|
72
65
|
tensor(int64),
|
73
66
|
tensor(int8),
|
74
67
|
tensor(uint16),
|
75
68
|
tensor(uint32),
|
76
69
|
tensor(uint64),
|
77
70
|
tensor(uint8)
|
78
71
|
):
|
79
72
|
Constrain input to only numeric types.
|
80
73
|
* **T3** in (
|
81
74
|
tensor(bool),
|
82
75
|
tensor(complex128),
|
83
76
|
tensor(complex64),
|
84
77
|
tensor(double),
|
85
78
|
tensor(float),
|
86
79
|
tensor(float16),
|
87
80
|
tensor(int16),
|
88
81
|
tensor(int32),
|
89
82
|
tensor(int64),
|
90
83
|
tensor(int8),
|
91
84
|
tensor(string),
|
92
85
|
tensor(uint16),
|
93
86
|
tensor(uint32),
|
94
87
|
tensor(uint64),
|
95
88
|
tensor(uint8)
|
96
89
|
):
|
97
90
|
Constrain to any tensor type.
|