create_dl_layer_poolingT_create_dl_layer_poolingCreateDlLayerPoolingCreateDlLayerPoolingcreate_dl_layer_pooling (Operator)

Name

create_dl_layer_poolingT_create_dl_layer_poolingCreateDlLayerPoolingCreateDlLayerPoolingcreate_dl_layer_pooling — Create a pooling layer.

Signature

create_dl_layer_pooling( : : DLLayerInput, LayerName, KernelSize, Stride, Padding, Mode, GenParamName, GenParamValue : DLLayerPooling)

Herror T_create_dl_layer_pooling(const Htuple DLLayerInput, const Htuple LayerName, const Htuple KernelSize, const Htuple Stride, const Htuple Padding, const Htuple Mode, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerPooling)

void CreateDlLayerPooling(const HTuple& DLLayerInput, const HTuple& LayerName, const HTuple& KernelSize, const HTuple& Stride, const HTuple& Padding, const HTuple& Mode, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerPooling)

HDlLayer HDlLayer::CreateDlLayerPooling(const HString& LayerName, const HTuple& KernelSize, const HTuple& Stride, const HTuple& Padding, const HString& Mode, const HTuple& GenParamName, const HTuple& GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerPooling(const HString& LayerName, const HTuple& KernelSize, const HTuple& Stride, const HString& Padding, const HString& Mode, const HString& GenParamName, const HString& GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerPooling(const char* LayerName, const HTuple& KernelSize, const HTuple& Stride, const char* Padding, const char* Mode, const char* GenParamName, const char* GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerPooling(const wchar_t* LayerName, const HTuple& KernelSize, const HTuple& Stride, const wchar_t* Padding, const wchar_t* Mode, const wchar_t* GenParamName, const wchar_t* GenParamValue) const   ( Windows only)

static void HOperatorSet.CreateDlLayerPooling(HTuple DLLayerInput, HTuple layerName, HTuple kernelSize, HTuple stride, HTuple padding, HTuple mode, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerPooling)

HDlLayer HDlLayer.CreateDlLayerPooling(string layerName, HTuple kernelSize, HTuple stride, HTuple padding, string mode, HTuple genParamName, HTuple genParamValue)

HDlLayer HDlLayer.CreateDlLayerPooling(string layerName, HTuple kernelSize, HTuple stride, string padding, string mode, string genParamName, string genParamValue)

def create_dl_layer_pooling(dllayer_input: HHandle, layer_name: str, kernel_size: Sequence[int], stride: Sequence[int], padding: MaybeSequence[Union[str, int]], mode: str, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]]) -> HHandle

Description

The operator create_dl_layer_poolingcreate_dl_layer_poolingCreateDlLayerPoolingCreateDlLayerPoolingCreateDlLayerPoolingcreate_dl_layer_pooling creates a pooling layer whose handle is returned in DLLayerPoolingDLLayerPoolingDLLayerPoolingDLLayerPoolingDLLayerPoolingdllayer_pooling.

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

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

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

The parameter StrideStrideStrideStridestridestride specifies how the filter is shifted.

The values for KernelSizeKernelSizeKernelSizeKernelSizekernelSizekernel_size and StrideStrideStrideStridestridestride can be set as

The parameter PaddingPaddingPaddingPaddingpaddingpadding 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 pooling layer are given by Thereby we use the following values: : output width, : input width, : 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 ModeModeModeModemodemode specifies the mode of the pooling operation. Supported modes are:

'average'"average""average""average""average""average":

The resulting pixel value is the average of all pixel values in the filter.

'maximum'"maximum""maximum""maximum""maximum""maximum":

The resulting pixel value is the maximum of all pixel values in the filter.

'global_average'"global_average""global_average""global_average""global_average""global_average":

Same as mode 'average'"average""average""average""average""average", but without the knowledge of the spatial dimensions of the input, it is possible to define the desired output dimensions via the parameter KernelSizeKernelSizeKernelSizeKernelSizekernelSizekernel_size. E.g., if the average over all pixel values of the input shall be returned, set the KernelSizeKernelSizeKernelSizeKernelSizekernelSizekernel_size to 1 and the output width and height is equal to 1. The internally used kernel size and stride are calculated as follows:

  • If KernelSizeKernelSizeKernelSizeKernelSizekernelSizekernel_size is a divisor of the input dimensions: The internally used kernel size and stride are both set to the value .

  • If KernelSizeKernelSizeKernelSizeKernelSizekernelSizekernel_size is not a divisor of the input dimension: The calculation of the internally used kernel size and stride depend on the generic parameter 'global_pooling_mode'"global_pooling_mode""global_pooling_mode""global_pooling_mode""global_pooling_mode""global_pooling_mode":

    'overlapping'"overlapping""overlapping""overlapping""overlapping""overlapping":

    The internally used is set to . The internally used kernel size is then computed as . This leads to overlapping kernels but the whole input image is taken into account for the computation of the output.

    'non_overlapping'"non_overlapping""non_overlapping""non_overlapping""non_overlapping""non_overlapping":

    The internally used kernel size and stride are set to the same value . This leads to non-overlapping pooling kernels, but parts of the input image at the right or bottom border might not be considered when computing the output. In this mode, due to rounding the output size is not always equal to the size given by KernelSizeKernelSizeKernelSizeKernelSizekernelSizekernel_size.

    'adaptive'"adaptive""adaptive""adaptive""adaptive""adaptive":

    In this mode, for each pixel of the output, the size of the corresponding pooling area within the input is computed adaptively, where are the row and are the column indices of the output. The row indices of the pooling area for pixels of the -th output row are given by , where in this case the height of the KernelSizeKernelSizeKernelSizeKernelSizekernelSizekernel_size is used. The computation of the column coordinates is done analogously. This means that neighboring pooling areas can have a different size which can lead to a less efficient implementation. However, the pooling areas are only overlapping by one pixel which is generally less overlap than for 'global_pooling_mode'"global_pooling_mode""global_pooling_mode""global_pooling_mode""global_pooling_mode""global_pooling_mode" 'overlapping'"overlapping""overlapping""overlapping""overlapping""overlapping". The whole input image is taken into account for the computation of the output. For this mode, the parameter PaddingPaddingPaddingPaddingpaddingpadding must be set to 'none'"none""none""none""none""none".

For this mode the parameter StrideStrideStrideStridestridestride is ignored and calculated internally as described above.

'global_maximum'"global_maximum""global_maximum""global_maximum""global_maximum""global_maximum":

Same as mode 'global_average'"global_average""global_average""global_average""global_average""global_average", but the maximum is calculated instead of the average.

For more information about the pooling layer see the “Solution Guide on Classification”.

The following generic parameters GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name and the corresponding values GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value are supported:

'global_pooling_mode'"global_pooling_mode""global_pooling_mode""global_pooling_mode""global_pooling_mode""global_pooling_mode":

Mode for calculation of the internally used kernel size and stride in case of global pooling (ModeModeModeModemodemode 'global_average'"global_average""global_average""global_average""global_average""global_average" or 'global_maximum'"global_maximum""global_maximum""global_maximum""global_maximum""global_maximum"). See description above. In case of a non-global pooling the parameter is set to the value 'undefined'"undefined""undefined""undefined""undefined""undefined".

Default: 'overlapping'"overlapping""overlapping""overlapping""overlapping""overlapping"

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

Determines whether apply_dl_modelapply_dl_modelApplyDlModelApplyDlModelApplyDlModelapply_dl_model will include the output of this layer in the dictionary DLResultBatchDLResultBatchDLResultBatchDLResultBatchDLResultBatchdlresult_batch even without specifying this layer in OutputsOutputsOutputsOutputsoutputsoutputs ('true'"true""true""true""true""true") or not ('false'"false""false""false""false""false").

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

Certain parameters of layers created using this operator create_dl_layer_poolingcreate_dl_layer_poolingCreateDlLayerPoolingCreateDlLayerPoolingCreateDlLayerPoolingcreate_dl_layer_pooling 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_paramSetDlModelLayerParamSetDlModelLayerParamSetDlModelLayerParamset_dl_model_layer_param and which ones can be retrieved using get_dl_model_layer_paramget_dl_model_layer_paramGetDlModelLayerParamGetDlModelLayerParamGetDlModelLayerParamget_dl_model_layer_param or get_dl_layer_paramget_dl_layer_paramGetDlLayerParamGetDlLayerParamGetDlLayerParamget_dl_layer_param. Note, the operators set_dl_model_layer_paramset_dl_model_layer_paramSetDlModelLayerParamSetDlModelLayerParamSetDlModelLayerParamset_dl_model_layer_param and get_dl_model_layer_paramget_dl_model_layer_paramGetDlModelLayerParamGetDlModelLayerParamGetDlModelLayerParamget_dl_model_layer_param require a model created by create_dl_modelcreate_dl_modelCreateDlModelCreateDlModelCreateDlModelcreate_dl_model.

Layer Parameters set get
'global'"global""global""global""global""global"
'global_pooling_mode'"global_pooling_mode""global_pooling_mode""global_pooling_mode""global_pooling_mode""global_pooling_mode"
'input_layer'"input_layer""input_layer""input_layer""input_layer""input_layer" (DLLayerInputDLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input)
'kernel_size'"kernel_size""kernel_size""kernel_size""kernel_size""kernel_size" (KernelSizeKernelSizeKernelSizeKernelSizekernelSizekernel_size)
'name'"name""name""name""name""name" (LayerNameLayerNameLayerNameLayerNamelayerNamelayer_name)
'output_layer'"output_layer""output_layer""output_layer""output_layer""output_layer" (DLLayerPoolingDLLayerPoolingDLLayerPoolingDLLayerPoolingDLLayerPoolingdllayer_pooling)
'padding'"padding""padding""padding""padding""padding" (PaddingPaddingPaddingPaddingpaddingpadding)
'padding_type'"padding_type""padding_type""padding_type""padding_type""padding_type" (PaddingPaddingPaddingPaddingpaddingpadding)
'pooling_mode'"pooling_mode""pooling_mode""pooling_mode""pooling_mode""pooling_mode" (ModeModeModeModemodemode)
'shape'"shape""shape""shape""shape""shape"
'stride'"stride""stride""stride""stride""stride" (StrideStrideStrideStridestridestride)
'type'"type""type""type""type""type"
Generic Layer Parameters set get
'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output""is_inference_output"
'num_trainable_params'"num_trainable_params""num_trainable_params""num_trainable_params""num_trainable_params""num_trainable_params"

Execution Information

Parameters

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

Feeding layer.

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

Name of the output layer.

KernelSizeKernelSizeKernelSizeKernelSizekernelSizekernel_size (input_control)  number-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width and height of the filter kernels.

Default: [2,2]

StrideStrideStrideStridestridestride (input_control)  number-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Bi-dimensional amount of filter shift.

Default: [2,2]

PaddingPaddingPaddingPaddingpaddingpadding (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" "none"

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

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

Mode of pooling operation.

Default: 'maximum' "maximum" "maximum" "maximum" "maximum" "maximum"

List of values: 'average'"average""average""average""average""average", 'global_average'"global_average""global_average""global_average""global_average""global_average", 'global_maximum'"global_maximum""global_maximum""global_maximum""global_maximum""global_maximum", 'maximum'"maximum""maximum""maximum""maximum""maximum"

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

Generic input parameter names.

Default: []

List of values: 'global_pooling_mode'"global_pooling_mode""global_pooling_mode""global_pooling_mode""global_pooling_mode""global_pooling_mode", 'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output""is_inference_output"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_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: 'adaptive'"adaptive""adaptive""adaptive""adaptive""adaptive", 'non_overlapping'"non_overlapping""non_overlapping""non_overlapping""non_overlapping""non_overlapping", 'overlapping'"overlapping""overlapping""overlapping""overlapping""overlapping", 'true'"true""true""true""true""true", 'false'"false""false""false""false""false", 1.0, 0.9, 0.0

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

Pooling layer.

Module

Deep Learning Training