Loading TOC...

cntk:pad

cntk:pad(
   $x as cntk:variable,
   $mode as xs:string,
   $head as xs:unsignedLong*,
   $foot as xs:unsignedLong*,
   $constant-value as xs:double,
   $name as xs:string
) as cntk:function

Summary

Pads a tensor according to the specified patterns. Three padding modes are supported: CONSTANT / REFLECT / SYMMETRIC.

Parameters
$x Tensor to be padded.
$mode Padding mode: C.ops.CONSTANT_PAD, C.ops.REFLECT_PAD and C.ops.SYMMETRIC_PAD.
$head
$foot
$constant-value The value used to fill the padding cells, only meaningful under CONSTANT mode.
$name The name of the function instance in the network.

Example

xquery version "1.0-ml";

let $input-variable1 := cntk:input-variable(cntk:shape((2,3)), "float", fn:false(), fn:false(), "feature")
let $model := cntk:pad($input-variable1,"constantpad",(1,3),(2,4),77)
let $input-values := (cntk:value(cntk:shape((2,3)), json:to-array((1,2,-3,4,5,6)), cntk:gpu(0), "float"))
let $pair1 := json:to-array(($input-variable1, $input-values))
let $input-pairs := json:to-array(($pair1))
let $output-variable := cntk:function-output($model)
let $output-value := cntk:evaluate($model, $input-pairs, $output-variable, cntk:gpu(0))
return (fn:replace(xdmp:quote($output-value), "0x[a-z|A-Z|0-9]*", "Value"), cntk:value-to-array($output-variable, $output-value))

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