Loading TOC...

cntk:labels-to-graph

cntk:labels-to-graph(
   $labels as cntk:variable,
   $name as xs:string
) as cntk:function

Summary

Conversion node from labels to graph. Typically used as an input to ForwardBackward node. This node’s objective is to transform input labels into a graph representing exact forward-backward criterion.

Parameters
$labels Input training labels.
$name The name of the function instance in the network.

Example

  xquery version "1.0-ml";

  let $labels := json:to-array((
  2.,0.,0.,0.,0.,0.,
  0.,0.,2.,0.,0.,0.,
  2.,0.,0.,0.,0.,0.,
  0.,2.,0.,0.,0.,0.,
  0.,0.,0.,2.,0.,0.,
  0.,0.,0.,0.,2.,0.,
  0.,0.,0.,0.,1.,0.,
  0.,0.,0.,0.,1.,0.,
  0.,0.,0.,0.,1.,0.,
  0.,0.,0.,0.,1.,0.
  ))
  let $input-dims := 7
  let $input-variable := cntk:input-variable(cntk:shape(($input-dims)), "float")
  let $labels-variable := cntk:input-variable(cntk:shape((6)), "float")
  let $model := cntk:dense-layer($input-variable, map:map()=>map:with("output-shape", cntk:shape((6))))
  let $labels-graph := cntk:labels-to-graph($labels-variable)
  let $fb := cntk:forward-backward($labels-graph, $model, 5, -1)
  let $input-value := cntk:value(cntk:shape(($input-dims)), json:to-array(1 to $input-dims * 10) )
  let $labels-value := cntk:value(cntk:shape((6)), $labels)
  let $output-variable := cntk:function-output($model)
  let $output-value := cntk:evaluate($fb, json:to-array((json:to-array(($input-variable, $input-value)), json:to-array(($labels-variable,$labels-value)))), ($output-variable))
  (:return cntk:value-to-array($output-variable, $output-value):)
  return xdmp:quote(cntk:value-shape($output-value))
  => cntk:shape(Shape([6 x 1 x 1]))

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