Loading TOC...

cntk:batch

cntk:batch(
   $shape as cntk:shape,
   $data as json:array,
   [$device as cntk:device],
   [$data-type as xs:string],
   [$read-only as xs:boolean]
) as cntk:value

Summary

Constructs a batch of cntk:value as a cntk:value. A CNTK batch is another special kind of cntk:value, with the outer most dimension being the "batch dimension", which is dynamic, and represents the number of values in this batch. The length of $data must be a multiple of the size represented by $shape. Notice that this function is almost identical to cntk:sequence. That's because both function returns a cntk:value with one additional dynamic axis, representing the sequence axis or the batch axis.

Parameters
$shape The shape of each value in the batch.
$data A one dimensional sequence of numbers representing the flattened view of the batch. The length must be a multiple of the size represented by $shape, otherwise an exception is thrown.
$device The device on which the batch resides.
$data-type The data type of this value. Can be "float" or "double". Default is "float".
$read-only Whether the batch is read only. Right now, only false is supported.

Example

  cntk:batch(cntk:shape((2,3)), json:to-array((1 to 12)))
  => cntk:value(Shape([2 x 3 x 1 x 2]), Device Kind Name(GPU))

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