Loading TOC...

cntk:evaluate

cntk:evaluate(
   $model as cntk:function,
   $input-variable-value-map as json:array,
   $output-variables as cntk:variable*,
   [$device as cntk:device]
) as cntk:value*

Summary

Evaluate a CNTK model/function using specified input values. Returns a sequence of cntk:value, in the same order as the sequence of output variables.

Parameters
$model A CNTK model/function. It can be defined in place, or loaded from a binary node in the database.
$input-variable-value-map The input variable value map as a json:array. This must be an array of array, where each inner array must have length 2 (essentially a pair), with the first element being the variable, and second element being the corresponding value.
$output-variables The output variables of the model. The output values will be in the same order as the output variables. This parameter is usually obtained by calling cntk:function-outputs($model)
$device The device on which the computation is performed. If not provided, the default device will be used.

Required Privileges

http://marklogic.com/cntk/privileges/cntk-evaluate

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")
  let $model := cntk:argmin($input-variable2, cntk:axis(0), "@<H54c")
  let $input-values := (
    cntk:batch(cntk:shape((3)), json:to-array((1 to 6)), cntk:cpu(), "float"),
    cntk:batch(cntk:shape((3)), json:to-array((2 to 7)), cntk:cpu(), "float"))
  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:function-output($model)
  return cntk:evaluate($model, $input-pairs, $output-variable, cntk:cpu())
  => cntk:value(Shape([1 x 1 x 2]), Device Kind Name(CPU))

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