Loading TOC...


   $operand as cntk:variable,
   $additional-parameters as map:map
) as cntk:function


Layer factory function to create a convolution layer.

$operand The operand of the operation.

"filter-shape": xs:unsignedLong*.

"num-filters": xs:unsignedLong.

"activation": xs:string. The optional activation to apply at the end.

"init": xs:double, or cntk:value, or cntk:initializer. Default: cntk:glorot-uniform-initializer().

"pad": xs:boolean*. Default: false.

"strides": xs:unsignedLong*. Default: 1.

"bias": xs:boolean. Default: true.

"bias-init": xs:double, or cntk:initializer. Default: 0.

"reduction-rank": xs:integer. Default: 1.

"dilation": xs:unsignedLong*. Default: 1.

"name": xs:string. Default: ""


xquery version "1.0-ml";
  xquery version "1.0-ml";

  let $num-classes := 2
  let $num-samples :=5
  let $input-shape := cntk:shape((64,28,3))
  let $input-variable := cntk:input-variable($input-shape, "float")
  let $convolution-option := map:map()=>
                            map:with("filter-shape", (3,3))=>
                            map:with("num-filters", 10)
  let $convolved-variable := cntk:convolution-layer($input-variable, $convolution-option)
  let $dense-option := map:map()=>
                      map:with("output-shape", cntk:shape(($num-classes)))
  let $dense-output := cntk:dense-layer($convolved-variable, $dense-option)
  let $input-value-array := json:to-array((1 to 64*28*3*$num-samples))
  let $input-value := cntk:value($input-shape, $input-value-array)
  let $label-shape := cntk:shape(($num-classes))
  let $label-variable := cntk:input-variable($label-shape, "float")
  let $label-array := json:to-array((1,0,0,1,0,1,1,0,0,1))
  let $label-value := cntk:value($label-shape, $label-array)
  let $learner := cntk:sgd-learner((cntk:function-parameters($dense-output)), cntk:learning-rate-schedule-from-constant(0.1))
  let $loss := cntk:cross-entropy-with-softmax($dense-output, $label-variable, cntk:axis(-1))
  let $trainer := cntk:trainer($dense-output, ($learner), $loss)

  return fn:replace(xdmp:quote(cntk:trainer-get-model($trainer)),"Input\d*", "Input")
  => cntk:function(Composite Dense (Input(Uid(Input), Shape([64 x 28 x 3]), Dynamic Axes([Sequence Axis(Default Dynamic Axis), Batch Axis(Default Batch Axis)]))))

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