Loading TOC...

cntk.evaluate

cntk.evaluate(
   $model as cntk.function,
   $input-variable-value-map as Array,
   $output-variables as cntk.variable[],
   [$device as cntk.device]
) as Sequence

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

  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")
  var model = cntk.argmin(inputVariable2, cntk.axis(0), "@<H54c")
  var inputValues = (
    cntk.batch(cntk.shape([3]), [1,2,3,4,5,6], cntk.cpu(), "float"),
    cntk.batch(cntk.shape([3]), [2,3,4,5,6,7], cntk.cpu(), "float"))
  var pair1 = [inputVariable1, inputValues[1]]
  var pair2 = [inputVariable2, inputValues[2]]
  var inputPairs = [pair1, pair2]
  var outputVariable = cntk.functionOutput(model)
  cntk.evaluate(model, inputPairs, outputVariable, 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.