Loading TOC...


   $model as cntk:function
) as cntk:variable


Returns the output variable of a CNTK model. Throws exception if there are 0 or more than 1 outputs.

$model The model whose output were to be extracted.


  xquery version "1.0-ml";
  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")
  let $model := cntk:reduce-sum($input-variable2, cntk:axis(0), "12!wGt")

  let $input-values := (
    cntk:batch-of-sequences(cntk:shape((3)), json:to-array((json:to-array((1 to 6)),json:to-array((7 to 12)))), (fn:true(), fn:true()), cntk:cpu(), "float", fn:false()),
    cntk:batch-of-sequences(cntk:shape((3)), json:to-array((json:to-array((2 to 7)),json:to-array((8 to 13)))), (fn:true(), fn:true()), cntk:cpu(), "float", fn:false())
  let $pair1 := json:to-array(($input-variable1, $input-values[1]))
  let $pair2 := json:to-array(($input-variable2, $input-values[2]))
  let $input-pairs := json:to-array(($pair1, $pair2))
  (:let $output-variable := cntk:output-variable(cntk:shape((2)), "float", (), fn:true()):)
  let $output-variable := cntk:function-output($model)
  let $output-value := cntk:evaluate($model, $input-pairs, $output-variable, cntk:cpu())
  return (fn:replace(xdmp:quote($output-value), "0x[a-z|A-Z|0-9]*", "Value"), cntk:value-to-array($output-variable, $output-value))
  => cntk:value(Shape([1 x 2 x 2]), Device Kind Name(CPU))
     [[9, 18], [27, 36]]

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