Skip to content

create_dl_layer_matmulCreateDlLayerMatmulCreateDlLayerMatmulcreate_dl_layer_matmulT_create_dl_layer_matmul🔗

Short description🔗

create_dl_layer_matmulCreateDlLayerMatmulCreateDlLayerMatmulcreate_dl_layer_matmulT_create_dl_layer_matmul — Create a MatMul layer.

Signature🔗

create_dl_layer_matmul( dl_layer DLLayerA, dl_layer DLLayerB, string LayerName, attribute.name GenParamName, attribute.value GenParamValue, out dl_layer DLLayerMatMul )void CreateDlLayerMatmul( const HTuple& DLLayerA, const HTuple& DLLayerB, const HTuple& LayerName, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerMatMul )static void HOperatorSet.CreateDlLayerMatmul( HTuple DLLayerA, HTuple DLLayerB, HTuple layerName, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerMatMul )def create_dl_layer_matmul( dllayer_a: HHandle, dllayer_b: HHandle, layer_name: str, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]] ) -> HHandle

Herror T_create_dl_layer_matmul( const Htuple DLLayerA, const Htuple DLLayerB, const Htuple LayerName, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerMatMul )

HDlLayer HDlLayer::CreateDlLayerMatmul( const HDlLayer& DLLayerB, const HString& LayerName, const HTuple& GenParamName, const HTuple& GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerMatmul( const HDlLayer& DLLayerB, const HString& LayerName, const HString& GenParamName, const HString& GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerMatmul( const HDlLayer& DLLayerB, const char* LayerName, const char* GenParamName, const char* GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerMatmul( const HDlLayer& DLLayerB, const wchar_t* LayerName, const wchar_t* GenParamName, const wchar_t* GenParamValue ) const (Windows only)

HDlLayer HDlLayer.CreateDlLayerMatmul( HDlLayer DLLayerB, string layerName, HTuple genParamName, HTuple genParamValue )

HDlLayer HDlLayer.CreateDlLayerMatmul( HDlLayer DLLayerB, string layerName, string genParamName, string genParamValue )

Description🔗

The operator create_dl_layer_matmulCreateDlLayerMatmul creates a MatMul layer whose handle is returned in DLLayerMatMulDLLayerMatMuldllayer_mat_mul.

A MatMul layer multiplies the 2D matrices, given in the latter two dimensions (H, W) of input DLLayerADLLayerAdllayer_a, with the corresponding 2D matrices of input DLLayerBDLLayerBdllayer_b, also given in the latter two dimensions (H, W). The output in DLLayerMatMulDLLayerMatMuldllayer_mat_mul is hence given by \(C = A \cdot B\).

The MatMul layer supports broadcasting for the first input DLLayerADLLayerAdllayer_a. That means, if the batch size or the number of channels in DLLayerADLLayerAdllayer_a equals one then the first batch item or channel of DLLayerADLLayerAdllayer_a is multiplied with all batch items or channels of DLLayerBDLLayerBdllayer_b, respectively.

To make the multiplication work, the width of DLLayerADLLayerAdllayer_a must be equal to the height of DLLayerBDLLayerBdllayer_b.

The following generic parameters GenParamNamegenParamNamegen_param_name and the corresponding values GenParamValuegenParamValuegen_param_value are supported:

  • 'is_inference_output'"is_inference_output": Determines whether apply_dl_modelApplyDlModel will include the output of this layer in the dictionary DLResultBatchDLResultBatchdlresult_batch even without specifying this layer in Outputsoutputsoutputs ('true'"true") or not ('false'"false").

    Default: 'false'"false"

  • 'num_trainable_params'"num_trainable_params": Number of trainable parameters (weights and biases) of the layer.

  • 'transpose_a'"transpose_a": Matrices of input DLLayerADLLayerAdllayer_a are transposed: \(C = A^T \cdot B\).

    Default: 'false'"false"

  • 'transpose_b'"transpose_b": Matrices of input DLLayerBDLLayerBdllayer_b are transposed: \(C = A \cdot B^T\).

    Default: 'false'"false"

Certain parameters of layers created using this operator create_dl_layer_matmulCreateDlLayerMatmul can be set and retrieved using further operators. The following tables give an overview, which parameters can be set using set_dl_model_layer_paramSetDlModelLayerParam and which ones can be retrieved using get_dl_model_layer_paramGetDlModelLayerParam or get_dl_layer_paramGetDlLayerParam. Note, the operators set_dl_model_layer_paramSetDlModelLayerParam and get_dl_model_layer_paramGetDlModelLayerParam require a model created by create_dl_modelCreateDlModel.

Layer Parameters set get
'input_layer'"input_layer" x
'name'"name" (LayerNamelayerNamelayer_name) x x
'output_layer'"output_layer" (DLLayerMatMulDLLayerMatMuldllayer_mat_mul) x
'shape'"shape" x
'transpose_a'"transpose_a" x
'transpose_b'"transpose_b" x
'type'"type" x
Generic Layer Parameters set get
'is_inference_output'"is_inference_output" x x
'num_trainable_params'"num_trainable_params" x

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

DLLayerADLLayerAdllayer_a (input_control) dl_layer → (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)

Input layer A.

DLLayerBDLLayerBdllayer_b (input_control) dl_layer → (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)

Input layer B.

LayerNamelayerNamelayer_name (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Name of the output layer.

GenParamNamegenParamNamegen_param_name (input_control) attribute.name(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Generic input parameter names.

Default: [][]
List of values: 'is_inference_output', 'num_trainable_params', 'transpose_a', 'transpose_b'"is_inference_output", "num_trainable_params", "transpose_a", "transpose_b"

GenParamValuegenParamValuegen_param_value (input_control) attribute.value(-array) → (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)MaybeSequence[Union[int, float, str]]Htuple (char* / Hlong / double)

Generic input parameter values.

Default: [][]
Suggested values: 'true', 'false'"true", "false"

DLLayerMatMulDLLayerMatMuldllayer_mat_mul (output_control) dl_layer → (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)

MatMul layer.

Module🔗

Deep Learning Professional