construct a one-hot Tensor
list of integers
(optional) options as specified below
axis = integer
The axis to fill (default: -1, a new inner-most axis).
datatype = one of string,truefalse,integer,integer,float,float,complex, or complex
The value of option datatype specifies the type of data this Tensor will hold. By default, the datatype is inferred from on_value or off_value.
off_value = scalar
The value to fill in output when indices[j] <> i (default: 0). If a datatype was specified, this value must be compatible with that type.
on_value = scalar
The value to fill in output when indices[j] = i (default: 1). If a datatype was specified, this value must be compatible with that type.
name = string
The value of option name specifies an optional name for this Tensor, to be displayed in output and when visualizing the dataflow graph.
The OneHot(indices,depth,opts) command creates a one-hot Tensor in the active dataflow graph. The term "one-hot" comes from digital circuits and refers to a configuration where every bit in a collection is turned off, except one.
In the Tensor returned, the locations represented by indices take value on_value, while all other locations take value off_value.
If the input indices is rank n, the output will have rank n+1. The new axis is created at the dimension specified by axis. By default, the new axis is appended at the end.
These functions are part of the DeepLearning package, so they can can be used in the short form OneHot(..) only after executing the command with(DeepLearning). However, can always be accessed through the long form of the command by using DeepLearning[OneHot](..).
The implementation of EinsteinSummation uses the tf.one_hot command from the TensorFlow Python API. Consult the TensorFlow Python API documentation for tf.one_hot for more information.
t≔DeepLearning TensorName: one_hot:0Shape: [3, 3]Data Type: float
The DeepLearning[OneHot] command was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
Download Help Document
What kind of issue would you like to report? (Optional)