Loading TOC...

cntk:batch-of-sequences

cntk:batch-of-sequences(
   $shape as cntk:shape,
   $data as json:array,
   $sequence-start-flags as xs:boolean*,
   [$device as cntk:device],
   [$data-type as xs:string],
   [$read-only as xs:boolean]
) as cntk:value

Summary

Constructs a batch of CNTK sequences as a cntk:value. A batch of sequence is yet another special kind of cntk:value, with the outer most dimension being the "batch dimension", followed by a "sequence dimension", where both axes are dynamic, and represents the number of sequences in this batch, and length of each sequence, respectively. In addition to the requirement of the length of $data being a multiple of the size represented by $shape, the length of $data must also equal the total size of numbers in the batch of sequences.

Parameters
$shape The shape of each value in the batch.
$data A json:array object, with each item being a json:array, representing a sequence, whose length is a multiple of the size represented by $shape.
$sequence-start-flags A sequence of flags. Each "true" means the corresponding sequence is the start of a new sequence, and "false" means this sequence is a continuation of the previous sequence.
$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-of-sequences(cntk:shape((2,3)),
json:to-array((json:to-array((1 to 6)),json:to-array((7 to
12)),json:to-array((13 to 24)))), (fn:true(), fn:true(), fn:true()))
  => a <code>cntk:value</code> object of shape 3 by * by 2 by 3, on the default
device, representing a batch of three sequences (length 1, 1, 2) of 2D matrices.
The first sequence is (notice the number of brackets) [[[1,2,3], [4,5,6]]],
second sequence is
[[[7,8,9],[10,11,12]]], third sequence is [[[13,14,15],[16,17,18]],
[[19,20,21],[22,23,24]]]

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