Loading TOC...

cntk:one-hot-op

cntk:one-hot-op(
   $x as cntk:variable,
   $num-class as xs:unsignedLong,
   $output-sparse as xs:boolean,
   $axis as cntk:axis,
   [$name as xs: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

  let $input-variable1 := cntk:input-variable(cntk:shape((3)), "float",
    fn:false(), fn:false(), "feature")
  let $input-variable2 := cntk:input-variable(cntk:shape((3)), "float",
    fn:false(), fn:false(), "feature")
  return cntk:one-hot-op($input-variable2, 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.