tf.Tensor
of indices with dtype int32
. Indices must
start from 0.
The depth of the one hot dimension.
Optional
onValue: numberA number used to fill in the output when the index matches the location.
Optional
offValue: numberA number used to fill in the output when the index does not match the location.
Optional
dtype: keyof DataTypeMapThe dtype of the output tensor, default to 'int32'.
Generated using TypeDoc
Creates a one-hot
tf.Tensor
. The locations represented byindices
take valueonValue
(defaults to 1), while all other locations take valueoffValue
(defaults to 0). Ifindices
is rankR
, the output has rankR+1
with the last axis of sizedepth
.indices
used to encode prediction class must start from 0. For example, if you have 3 classes of data, class 1 should be encoded as 0, class 2 should be 1, and class 3 should be 2.