create_dl_layer_convolution T_create_dl_layer_convolution CreateDlLayerConvolution CreateDlLayerConvolution create_dl_layer_convolution (Operator)
Name
create_dl_layer_convolution T_create_dl_layer_convolution CreateDlLayerConvolution CreateDlLayerConvolution create_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_convolution create_dl_layer_convolution CreateDlLayerConvolution CreateDlLayerConvolution create_dl_layer_convolution
creates a convolutional
layer with NumKernel NumKernel NumKernel numKernel num_kernel
kernels in
Groups Groups Groups groups groups
filter groups whose handle is returned in
DLLayerConvolution DLLayerConvolution DLLayerConvolution DLLayerConvolution dllayer_convolution
.
The parameter DLLayerInput DLLayerInput DLLayerInput DLLayerInput dllayer_input
determines the feeding input layer and
expects the layer handle as value.
The parameter LayerName LayerName LayerName layerName layer_name
sets an individual layer name.
Note that if creating a model using create_dl_model create_dl_model CreateDlModel CreateDlModel create_dl_model
each layer of
the created network must have a unique name.
The parameter KernelSize KernelSize KernelSize kernelSize kernel_size
specifies the filter kernel in the
dimensions width
and height
.
The parameter Dilation Dilation Dilation dilation dilation
specifies the factor
of filter dilation in the dimensions width
and height
.
The parameter Stride Stride Stride stride stride
specifies how the filter is shifted.
The values for KernelSize KernelSize KernelSize kernelSize kernel_size
, Dilation Dilation Dilation dilation dilation
, and Stride Stride Stride stride stride
can be set as
a single value which is used for both dimensions
a tuple [width, height]
and [column, row]
,
respectively.
The parameter Groups Groups Groups groups groups
specifies the number of filter groups.
The parameter NumKernel NumKernel NumKernel numKernel num_kernel
specifies the number of filter kernels.
NumKernel NumKernel NumKernel numKernel num_kernel
must be a multiple of Groups Groups Groups groups groups
.
The parameter Padding Padding Padding padding padding
determines the padding, thus
how many pixels with value 0 are appended on the border of the
processed input image. Supported values are:
'half_kernel_size' "half_kernel_size" "half_kernel_size" "half_kernel_size" "half_kernel_size" : The number of appended pixels
depends on the specified KernelSize KernelSize KernelSize kernelSize kernel_size
.
More precisely, it is calculated as
,
where for the padding on the left / right border the value of
KernelSize KernelSize KernelSize kernelSize kernel_size
in dimension width
is regarded
and for the padding on the upper / lower border the value of
KernelSize KernelSize KernelSize kernelSize kernel_size
in height
.
'none' "none" "none" "none" "none" : No pixels are appended.
Number of pixels: Specify the number of pixels
appended on each border. To do so, the following tuple lengths are
supported:
Single number: Padding in all four directions
left/right/top/bottom.
Two numbers: Padding in left/right and top/bottom:
[l/r, t/b]
.
Four numbers: Padding on left, right, top, bottom side:
[l,r,t,b]
.
Restriction: 'runtime' "runtime" "runtime" "runtime" "runtime" 'gpu' "gpu" "gpu" "gpu" "gpu" does
not support asymmetric padding, i.e., the padding values for the
left and right side must be equal, as well as the padding values for
the top and bottom side.
Restriction: The integer padding values must be smaller
than the value set for KernelSize KernelSize KernelSize kernelSize kernel_size
in the corresponding dimension.
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 Activation Activation Activation activation activation
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 GenParamName GenParamName GenParamName genParamName gen_param_name
and the corresponding
values GenParamValue GenParamValue GenParamValue genParamValue gen_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_model apply_dl_model ApplyDlModel ApplyDlModel apply_dl_model
will include the output of this
layer in the dictionary DLResultBatch DLResultBatch DLResultBatch DLResultBatch dlresult_batch
even without specifying this
layer in Outputs Outputs Outputs outputs outputs
('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_convolution create_dl_layer_convolution CreateDlLayerConvolution CreateDlLayerConvolution create_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_param set_dl_model_layer_param SetDlModelLayerParam SetDlModelLayerParam set_dl_model_layer_param
and which ones can be retrieved
using get_dl_model_layer_param get_dl_model_layer_param GetDlModelLayerParam GetDlModelLayerParam get_dl_model_layer_param
or get_dl_layer_param get_dl_layer_param GetDlLayerParam GetDlLayerParam get_dl_layer_param
.
Note, the operators set_dl_model_layer_param set_dl_model_layer_param SetDlModelLayerParam SetDlModelLayerParam set_dl_model_layer_param
and
get_dl_model_layer_param get_dl_model_layer_param GetDlModelLayerParam GetDlModelLayerParam get_dl_model_layer_param
require a model created by
create_dl_model create_dl_model CreateDlModel CreateDlModel create_dl_model
.
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
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
Multithreading scope: global (may be called from any thread).
Processed without parallelization.
Parameters
DLLayerInput DLLayerInput DLLayerInput DLLayerInput dllayer_input
(input_control) dl_layer →
HDlLayer , HTuple HHandle HTuple Htuple (handle) (IntPtr ) (HHandle ) (handle )
Feeding layer.
LayerName LayerName LayerName layerName layer_name
(input_control) string →
HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
Name of the output layer.
KernelSize KernelSize KernelSize kernelSize kernel_size
(input_control) number(-array) →
HTuple MaybeSequence[int] HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Width and height of the filter kernels.
Default:
3
Dilation Dilation Dilation dilation dilation
(input_control) number(-array) →
HTuple MaybeSequence[int] HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Amount of filter dilation for width and height.
Default:
1
Stride Stride Stride stride stride
(input_control) number(-array) →
HTuple MaybeSequence[int] HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Amount of filter shift in width and height direction.
Default:
1
NumKernel NumKernel NumKernel numKernel num_kernel
(input_control) number →
HTuple int HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Number of filter kernels.
Default:
64
Groups Groups Groups groups groups
(input_control) number →
HTuple int HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Number of filter groups.
Default:
1
Padding Padding Padding padding padding
(input_control) number(-array) →
HTuple MaybeSequence[Union[str, int]] HTuple Htuple (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"
Activation Activation Activation activation activation
(input_control) number →
HTuple str HTuple Htuple (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"
GenParamName GenParamName GenParamName genParamName gen_param_name
(input_control) attribute.name(-array) →
HTuple MaybeSequence[str] HTuple Htuple (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"
GenParamValue GenParamValue GenParamValue genParamValue gen_param_value
(input_control) attribute.value(-array) →
HTuple MaybeSequence[Union[int, float, str]] HTuple Htuple (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
DLLayerConvolution DLLayerConvolution DLLayerConvolution DLLayerConvolution dllayer_convolution
(output_control) dl_layer →
HDlLayer , HTuple HHandle HTuple Htuple (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