Loading TOC...

cntk.oneHotOp

cntk.oneHotOp(
   $x as cntk.variable,
   $num-class as (Number|String),
   $output-sparse as Boolean,
   $axis as cntk.axis,
   [$name as String]
) as cntk.function

Summary

Create one hot tensor based on the input tensor.

Parameters
$x Input tensor, the value must be positive integer and less than num_class.
$num-class The number of class in one hot tensor.
$output-sparse If set as True, we will create the one hot tensor as sparse.
$axis The axis to fill (default: -1, a new inner-most axis).
$name The name of the function instance in the network.

Example

  var inputVariable1 = cntk.inputVariable(cntk.shape([3]), "float",
    fn.false(), fn.false(), "feature")
  var inputVariable2 = cntk.inputVariable(cntk.shape([3]), "float",
    fn.false(), fn.false(), "feature")
  cntk.oneHotOp(inputVariable2, 3, fn.false(), cntk.axis(0),
    "4g9# !_V/")
  => cntk.function(Composite OneHotOp (Input(Name(feature), Shape([3]), Dynamic
  Axes([Sequence Axis(Default Dynamic Axis), Batch Axis(Default Batch Axis)]))))

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.