Loading TOC...


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


Construct an embedding layer based and apply on operand. An embedding layer does a matrix multiplication of a look-up table with the input. The look-up table can be learnable parameter (init), or fixed (weight).

$operand The operand of the operation.

"shape": cntk:shape. The shape of the output of this layer.

"init": xs:double, or cntk:value, or cntk:initializer. Default: cntk:glorot-uniform-initializer(). Initial value of the look-up table. Learnable. weight cannot be given.

"weight": cntk:value. User supplied look-up table. Non learnable. init cannot be given.

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


  xquery version "1.0-ml";
  let $shape := cntk:shape((3,3,10))
  let $shape1 :=cntk:shape((5))
  let $input-variable := cntk:input-variable($shape, "float", fn:false(), fn:false(), "feature")
  let $model := cntk:embedding-layer($input-variable, 
  map:with("weight" ,cntk:value($shape1,json:to-array((1 to cntk:shape-total-size($shape1)))))
  let $input-value := cntk:sequence($shape, json:to-array((1 to cntk:shape-total-size($shape))),fn:true(), cntk:cpu(), "float")
  let $pair := json:to-array(($input-variable, $input-value))
  let $output-variable := cntk:function-output($model)
  let $output-value := cntk:evaluate($model, $pair, $output-variable, cntk:cpu())
  return (
  "Value Shape : ", xdmp:quote(cntk:value-shape($output-value)), "
  "Value Device : ", xdmp:quote(cntk:value-device($output-value)), "
  "Variable Owner : ", xdmp:quote(cntk:variable-owner($output-variable)), "
  "Result Type : ", xdmp:type(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.