create_dl_layer_convolutionT_create_dl_layer_convolutionCreateDlLayerConvolutionCreateDlLayerConvolutioncreate_dl_layer_convolution (Operator)

Name

create_dl_layer_convolutionT_create_dl_layer_convolutionCreateDlLayerConvolutionCreateDlLayerConvolutioncreate_dl_layer_convolution — Create a convolutional layer.

Signature

create_dl_layer_convolution( : : DLLayerInput, LayerName, KernelSize, Dilation, Stride, NumKernel, Groups, Padding, Activation, GenParamName, GenParamValue : DLLayerConvolution)

Herror T_create_dl_layer_convolution(const Htuple DLLayerInput, const Htuple LayerName, const Htuple KernelSize, const Htuple Dilation, const Htuple Stride, const Htuple NumKernel, const Htuple Groups, const Htuple Padding, const Htuple Activation, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerConvolution)

void CreateDlLayerConvolution(const HTuple& DLLayerInput, const HTuple& LayerName, const HTuple& KernelSize, const HTuple& Dilation, const HTuple& Stride, const HTuple& NumKernel, const HTuple& Groups, const HTuple& Padding, const HTuple& Activation, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerConvolution)

HDlLayer HDlLayer::CreateDlLayerConvolution(const HString& LayerName, const HTuple& KernelSize, const HTuple& Dilation, const HTuple& Stride, Hlong NumKernel, Hlong Groups, const HTuple& Padding, const HString& Activation, const HTuple& GenParamName, const HTuple& GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerConvolution(const HString& LayerName, Hlong KernelSize, Hlong Dilation, Hlong Stride, Hlong NumKernel, Hlong Groups, const HString& Padding, const HString& Activation, const HString& GenParamName, const HString& GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerConvolution(const char* LayerName, Hlong KernelSize, Hlong Dilation, Hlong Stride, Hlong NumKernel, Hlong Groups, const char* Padding, const char* Activation, const char* GenParamName, const char* GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerConvolution(const wchar_t* LayerName, Hlong KernelSize, Hlong Dilation, Hlong Stride, Hlong NumKernel, Hlong Groups, const wchar_t* Padding, const wchar_t* Activation, const wchar_t* GenParamName, const wchar_t* GenParamValue) const   ( Windows only)

static void HOperatorSet.CreateDlLayerConvolution(HTuple DLLayerInput, HTuple layerName, HTuple kernelSize, HTuple dilation, HTuple stride, HTuple numKernel, HTuple groups, HTuple padding, HTuple activation, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerConvolution)

HDlLayer HDlLayer.CreateDlLayerConvolution(string layerName, HTuple kernelSize, HTuple dilation, HTuple stride, int numKernel, int groups, HTuple padding, string activation, HTuple genParamName, HTuple genParamValue)

HDlLayer HDlLayer.CreateDlLayerConvolution(string layerName, int kernelSize, int dilation, int stride, int numKernel, int groups, string padding, string activation, string genParamName, string genParamValue)

def create_dl_layer_convolution(dllayer_input: HHandle, layer_name: str, kernel_size: MaybeSequence[int], dilation: MaybeSequence[int], stride: MaybeSequence[int], num_kernel: int, groups: int, padding: MaybeSequence[Union[str, int]], activation: str, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]]) -> HHandle

Description

The operator create_dl_layer_convolutioncreate_dl_layer_convolutionCreateDlLayerConvolutionCreateDlLayerConvolutioncreate_dl_layer_convolution creates a convolutional layer with NumKernelNumKernelNumKernelnumKernelnum_kernel kernels in GroupsGroupsGroupsgroupsgroups filter groups whose handle is returned in DLLayerConvolutionDLLayerConvolutionDLLayerConvolutionDLLayerConvolutiondllayer_convolution.

The parameter DLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input determines the feeding input layer and expects the layer handle as value.

The parameter LayerNameLayerNameLayerNamelayerNamelayer_name sets an individual layer name. Note that if creating a model using create_dl_modelcreate_dl_modelCreateDlModelCreateDlModelcreate_dl_model each layer of the created network must have a unique name.

The parameter KernelSizeKernelSizeKernelSizekernelSizekernel_size specifies the filter kernel in the dimensions width and height.

The parameter DilationDilationDilationdilationdilation specifies the factor of filter dilation in the dimensions width and height.

The parameter StrideStrideStridestridestride specifies how the filter is shifted.

The values for KernelSizeKernelSizeKernelSizekernelSizekernel_size, DilationDilationDilationdilationdilation, and StrideStrideStridestridestride can be set as

The parameter GroupsGroupsGroupsgroupsgroups specifies the number of filter groups.

The parameter NumKernelNumKernelNumKernelnumKernelnum_kernel specifies the number of filter kernels. NumKernelNumKernelNumKernelnumKernelnum_kernel must be a multiple of GroupsGroupsGroupsgroupsgroups.

The parameter PaddingPaddingPaddingpaddingpadding determines the padding, thus how many pixels with value 0 are appended on the border of the processed input image. Supported values are:

The output dimensions of the convolution layer are given by Thereby we use the following values: : output width/height, : input width/height, : number of pixels added to the left/top of the input image, and : number of pixels added to the right/bottom of the input image.

The parameter ActivationActivationActivationactivationactivation determines whether an activation is performed after the convolution in order to optimize the runtime performance. The following values are supported:

We refer to the “Solution Guide on Classification” for more general information about the convolution layer and the reference given below for more detailed information about the arithmetic of the layer.

The following generic parameters GenParamNameGenParamNameGenParamNamegenParamNamegen_param_name and the corresponding values GenParamValueGenParamValueGenParamValuegenParamValuegen_param_value are supported:

'bias_filler'"bias_filler""bias_filler""bias_filler""bias_filler":

See 'weight_filler'"weight_filler""weight_filler""weight_filler""weight_filler" for an explanation of the values.

List of values: 'xavier'"xavier""xavier""xavier""xavier", 'msra'"msra""msra""msra""msra", 'const'"const""const""const""const".

Default: 'const'"const""const""const""const"

'bias_filler_variance_norm'"bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm":

See 'weight_filler_variance_norm'"weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm" for an explanation of the values.

List of values: 'norm_in'"norm_in""norm_in""norm_in""norm_in", 'norm_out'"norm_out""norm_out""norm_out""norm_out", 'norm_average'"norm_average""norm_average""norm_average""norm_average".

Default: 'norm_out'"norm_out""norm_out""norm_out""norm_out"

'bias_filler_const_val'"bias_filler_const_val""bias_filler_const_val""bias_filler_const_val""bias_filler_const_val":

Specifies the constant bias term initialization value if 'bias_filler'"bias_filler""bias_filler""bias_filler""bias_filler" has been set to 'const'"const""const""const""const".

Restriction: Ignored for other values of 'bias_filler'"bias_filler""bias_filler""bias_filler""bias_filler".

Default: 0

'bias_term'"bias_term""bias_term""bias_term""bias_term":

Determines whether the created convolutional layer has a bias term ('true'"true""true""true""true") or not ('false'"false""false""false""false").

Default: 'true'"true""true""true""true"

'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output":

Determines whether apply_dl_modelapply_dl_modelApplyDlModelApplyDlModelapply_dl_model will include the output of this layer in the dictionary DLResultBatchDLResultBatchDLResultBatchDLResultBatchdlresult_batch even without specifying this layer in OutputsOutputsOutputsoutputsoutputs ('true'"true""true""true""true") or not ('false'"false""false""false""false").

Default: 'false'"false""false""false""false"

'learning_rate_multiplier'"learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier":

Multiplier for the learning rate for this layer that is used during training. If 'learning_rate_multiplier'"learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier" is set to 0.0, the layer is skipped during training.

Default: 1.0

'learning_rate_multiplier_bias'"learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias":

Multiplier for the learning rate of the bias term. The total bias learning rate is the product of 'learning_rate_multiplier_bias'"learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias" and 'learning_rate_multiplier'"learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier".

Default: 1.0

'upper_bound'"upper_bound""upper_bound""upper_bound""upper_bound":

Float value, which defines the upper bound for ReLU. To unset the upper bound, set 'upper_bound'"upper_bound""upper_bound""upper_bound""upper_bound" to an empty tuple.

Default: []

'weight_filler'"weight_filler""weight_filler""weight_filler""weight_filler":

This parameter defines the mode how the weights are initialized. The following values are supported:

  • 'const'"const""const""const""const": The weights are filled with constant values.

  • 'msra'"msra""msra""msra""msra": The weights are drawn from a Gaussian distribution.

  • 'xavier'"xavier""xavier""xavier""xavier": The weights are drawn from a uniform distribution.

Default: 'xavier'"xavier""xavier""xavier""xavier"

'weight_filler_const_val'"weight_filler_const_val""weight_filler_const_val""weight_filler_const_val""weight_filler_const_val":

Specifies the constant weight initialization value.

Restriction: Only applied if 'weight_filler'"weight_filler""weight_filler""weight_filler""weight_filler" = 'const'"const""const""const""const".

Default: 0.5

'weight_filler_variance_norm'"weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm":

This parameter determines the value range for 'weight_filler'"weight_filler""weight_filler""weight_filler""weight_filler". The following values are supported:

  • 'norm_average'"norm_average""norm_average""norm_average""norm_average": the values are based on the average of the input and output size

  • 'norm_in'"norm_in""norm_in""norm_in""norm_in": the values are based on the input size

  • 'norm_out'"norm_out""norm_out""norm_out""norm_out": the values are based on the output size.

Default: 'norm_in'"norm_in""norm_in""norm_in""norm_in"

Certain parameters of layers created using create_dl_layer_convolutioncreate_dl_layer_convolutionCreateDlLayerConvolutionCreateDlLayerConvolutioncreate_dl_layer_convolution can be set and retrieved using further operators. The following tables give an overview, which parameters can be set using set_dl_model_layer_paramset_dl_model_layer_paramSetDlModelLayerParamSetDlModelLayerParamset_dl_model_layer_param and which ones can be retrieved using get_dl_model_layer_paramget_dl_model_layer_paramGetDlModelLayerParamGetDlModelLayerParamget_dl_model_layer_param or get_dl_layer_paramget_dl_layer_paramGetDlLayerParamGetDlLayerParamget_dl_layer_param. Note, the operators set_dl_model_layer_paramset_dl_model_layer_paramSetDlModelLayerParamSetDlModelLayerParamset_dl_model_layer_param and get_dl_model_layer_paramget_dl_model_layer_paramGetDlModelLayerParamGetDlModelLayerParamget_dl_model_layer_param require a model created by create_dl_modelcreate_dl_modelCreateDlModelCreateDlModelcreate_dl_model.

Layer Parameters set get
'activation_mode'"activation_mode""activation_mode""activation_mode""activation_mode" (ActivationActivationActivationactivationactivation) x
'dilation'"dilation""dilation""dilation""dilation" (DilationDilationDilationdilationdilation) x
'groups'"groups""groups""groups""groups" (GroupsGroupsGroupsgroupsgroups) x
'input_depth'"input_depth""input_depth""input_depth""input_depth" x
'input_layer'"input_layer""input_layer""input_layer""input_layer" (DLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input) x
'kernel_size'"kernel_size""kernel_size""kernel_size""kernel_size" (KernelSizeKernelSizeKernelSizekernelSizekernel_size) x
'name'"name""name""name""name" (LayerNameLayerNameLayerNamelayerNamelayer_name) x x
'num_kernels'"num_kernels""num_kernels""num_kernels""num_kernels" (NumKernelNumKernelNumKernelnumKernelnum_kernel) x
'output_layer'"output_layer""output_layer""output_layer""output_layer" (DLLayerConvolutionDLLayerConvolutionDLLayerConvolutionDLLayerConvolutiondllayer_convolution) x
'padding'"padding""padding""padding""padding" (PaddingPaddingPaddingpaddingpadding) x
'padding_type'"padding_type""padding_type""padding_type""padding_type" (PaddingPaddingPaddingpaddingpadding) x
'shape'"shape""shape""shape""shape" x
'stride'"stride""stride""stride""stride" (StrideStrideStridestridestride) x
'type'"type""type""type""type" x
Generic Layer Parameters set get
'bias_filler'"bias_filler""bias_filler""bias_filler""bias_filler" x x
'bias_filler_const_val'"bias_filler_const_val""bias_filler_const_val""bias_filler_const_val""bias_filler_const_val" x x
'bias_filler_variance_norm'"bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm" x x
'bias_term'"bias_term""bias_term""bias_term""bias_term" x
'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output" x x
'learning_rate_multiplier'"learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier" x x
'learning_rate_multiplier_bias'"learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias" x x
'num_trainable_params'"num_trainable_params""num_trainable_params""num_trainable_params""num_trainable_params" x
'upper_bound'"upper_bound""upper_bound""upper_bound""upper_bound" x x
'weight_filler'"weight_filler""weight_filler""weight_filler""weight_filler" x x
'weight_filler_const_val'"weight_filler_const_val""weight_filler_const_val""weight_filler_const_val""weight_filler_const_val" x x
'weight_filler_variance_norm'"weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm" x x

Execution Information

Parameters

DLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input (input_control)  dl_layer HDlLayer, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Feeding layer.

LayerNameLayerNameLayerNamelayerNamelayer_name (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Name of the output layer.

KernelSizeKernelSizeKernelSizekernelSizekernel_size (input_control)  number(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width and height of the filter kernels.

Default: 3

DilationDilationDilationdilationdilation (input_control)  number(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Amount of filter dilation for width and height.

Default: 1

StrideStrideStridestridestride (input_control)  number(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Amount of filter shift in width and height direction.

Default: 1

NumKernelNumKernelNumKernelnumKernelnum_kernel (input_control)  number HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of filter kernels.

Default: 64

GroupsGroupsGroupsgroupsgroups (input_control)  number HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of filter groups.

Default: 1

PaddingPaddingPaddingpaddingpadding (input_control)  number(-array) HTupleMaybeSequence[Union[str, int]]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Padding type or specific padding size.

Default: 'none' "none" "none" "none" "none"

List of values: [all], [width,height], [left,right,top,bottom], 'half_kernel_size'"half_kernel_size""half_kernel_size""half_kernel_size""half_kernel_size", 'none'"none""none""none""none"

Suggested values: 'none'"none""none""none""none", 'half_kernel_size'"half_kernel_size""half_kernel_size""half_kernel_size""half_kernel_size"

ActivationActivationActivationactivationactivation (input_control)  number HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Enable optional ReLU or sigmoid activations.

Default: 'none' "none" "none" "none" "none"

List of values: 'none'"none""none""none""none", 'relu'"relu""relu""relu""relu", 'sigmoid'"sigmoid""sigmoid""sigmoid""sigmoid"

GenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (input_control)  attribute.name(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Generic input parameter names.

Default: []

List of values: 'bias_filler'"bias_filler""bias_filler""bias_filler""bias_filler", 'bias_filler_const_val'"bias_filler_const_val""bias_filler_const_val""bias_filler_const_val""bias_filler_const_val", 'bias_filler_variance_norm'"bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm", 'bias_term'"bias_term""bias_term""bias_term""bias_term", 'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output", 'learning_rate_multiplier'"learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier", 'learning_rate_multiplier_bias'"learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias", 'upper_bound'"upper_bound""upper_bound""upper_bound""upper_bound", 'weight_filler'"weight_filler""weight_filler""weight_filler""weight_filler", 'weight_filler_const_val'"weight_filler_const_val""weight_filler_const_val""weight_filler_const_val""weight_filler_const_val", 'weight_filler_variance_norm'"weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm"

GenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (input_control)  attribute.value(-array) HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Generic input parameter values.

Default: []

Suggested values: 'xavier'"xavier""xavier""xavier""xavier", 'msra'"msra""msra""msra""msra", 'const'"const""const""const""const", 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor", 'bilinear'"bilinear""bilinear""bilinear""bilinear", 'norm_in'"norm_in""norm_in""norm_in""norm_in", 'norm_out'"norm_out""norm_out""norm_out""norm_out", 'norm_average'"norm_average""norm_average""norm_average""norm_average", 'true'"true""true""true""true", 'false'"false""false""false""false", 1.0, 0.9, 0.0

DLLayerConvolutionDLLayerConvolutionDLLayerConvolutionDLLayerConvolutiondllayer_convolution (output_control)  dl_layer HDlLayer, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Convolutional layer.

References

V. Dumoulin, F. Visin: "A guide to convolution arithmetic for deep learning", 2018, http://arxiv.org/abs/1603.07285

Module

Deep Learning Training