create_dl_layer_reduceT_create_dl_layer_reduceCreateDlLayerReduceCreateDlLayerReducecreate_dl_layer_reduce (Operator)

Name

create_dl_layer_reduceT_create_dl_layer_reduceCreateDlLayerReduceCreateDlLayerReducecreate_dl_layer_reduce — Create a reduce layer.

Signature

create_dl_layer_reduce( : : DLLayerInput, LayerName, Operation, Axes, GenParamName, GenParamValue : DLLayerReduce)

Herror T_create_dl_layer_reduce(const Htuple DLLayerInput, const Htuple LayerName, const Htuple Operation, const Htuple Axes, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerReduce)

void CreateDlLayerReduce(const HTuple& DLLayerInput, const HTuple& LayerName, const HTuple& Operation, const HTuple& Axes, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerReduce)

HDlLayer HDlLayer::CreateDlLayerReduce(const HString& LayerName, const HString& Operation, const HTuple& Axes, const HTuple& GenParamName, const HTuple& GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerReduce(const HString& LayerName, const HString& Operation, Hlong Axes, const HString& GenParamName, const HString& GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerReduce(const char* LayerName, const char* Operation, Hlong Axes, const char* GenParamName, const char* GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerReduce(const wchar_t* LayerName, const wchar_t* Operation, Hlong Axes, const wchar_t* GenParamName, const wchar_t* GenParamValue) const   ( Windows only)

static void HOperatorSet.CreateDlLayerReduce(HTuple DLLayerInput, HTuple layerName, HTuple operation, HTuple axes, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerReduce)

HDlLayer HDlLayer.CreateDlLayerReduce(string layerName, string operation, HTuple axes, HTuple genParamName, HTuple genParamValue)

HDlLayer HDlLayer.CreateDlLayerReduce(string layerName, string operation, int axes, string genParamName, string genParamValue)

def create_dl_layer_reduce(dllayer_input: HHandle, layer_name: str, operation: str, axes: MaybeSequence[Union[int, str]], gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]]) -> HHandle

Description

The operator create_dl_layer_reducecreate_dl_layer_reduceCreateDlLayerReduceCreateDlLayerReducecreate_dl_layer_reduce creates a reduce layer whose handle is returned in DLLayerReduceDLLayerReduceDLLayerReduceDLLayerReducedllayer_reduce.

A reduce layer applies a given operation to the input data tensor to reduce it along one or multiple axes to a single value. Hence, the output tensor has the same shape as the input tensor, but at the axes given by AxesAxesAxesaxesaxes the dimension equals one.

The parameter DLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input determines the feeding input layer. This layer expects a single layer as input.

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 OperationOperationOperationoperationoperation specifies the operation that is applied. The operation is applied to the values along the axes given by AxesAxesAxesaxesaxes of the input tensor and the result is written to the corresponding position in the output tensor. The supported values for OperationOperationOperationoperationoperation are:

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

'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"

'div_eps'"div_eps""div_eps""div_eps""div_eps":

Small scalar value that is used to stabilize the training. I.e., in case of a division, the value is added to the denominator to prevent a division by zero.

Default: 1e-10

Certain parameters of layers created using this operator create_dl_layer_reducecreate_dl_layer_reduceCreateDlLayerReduceCreateDlLayerReducecreate_dl_layer_reduce 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-Parameter set get
'axes'"axes""axes""axes""axes" (AxesAxesAxesaxesaxes) x
'input_layer'"input_layer""input_layer""input_layer""input_layer" (DLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input) x
'name'"name""name""name""name" (LayerNameLayerNameLayerNamelayerNamelayer_name) x x
'operation'"operation""operation""operation""operation" (OperationOperationOperationoperationoperation) x
'output_layer'"output_layer""output_layer""output_layer""output_layer" (DLLayerReduceDLLayerReduceDLLayerReduceDLLayerReducedllayer_reduce) x
'shape'"shape""shape""shape""shape" x
'type'"type""type""type""type" x
Generische Layer-Parameter set get
'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output" x x
'num_trainable_params'"num_trainable_params""num_trainable_params""num_trainable_params""num_trainable_params" x
'div_eps'"div_eps""div_eps""div_eps""div_eps" x

Execution Information

Parameters

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

Feeding input layer.

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

Name of the output layer.

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

Reduce operation.

Default: 'norm_l2' "norm_l2" "norm_l2" "norm_l2" "norm_l2"

List of values: 'norm_l2'"norm_l2""norm_l2""norm_l2""norm_l2", 'sum'"sum""sum""sum""sum"

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

Axes to which the reduce operation is applied.

Default: [2,3]

List of values: 1, 2, 3, 'depth'"depth""depth""depth""depth", 'height'"height""height""height""height", 'width'"width""width""width""width"

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

Generic input parameter names.

Default: []

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

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: 1e-10, 'true'"true""true""true""true", 'false'"false""false""false""false"

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

Reduce layer.

Example (HDevelop)

* Minimal example for reduce-layer.
create_dl_layer_input ('input', [64, 32, 10], [], [], DLLayerInput)
create_dl_layer_reduce (DLLayerInput, 'reduce_width', 'sum', 'width', [], [], \
                         DLLayerReduceWidth)
create_dl_layer_reduce (DLLayerReduceWidth, 'reduce_height_depth', 'norm_l2',  [1,2], [], \
                         [], DLLayerReduceHeightDepth)
* Create a model and change the batch-size.
create_dl_model (DLLayerReduceHeightDepth, DLModel)
set_dl_model_param (DLModel, 'batch_size', 2)
get_dl_model_layer_param (DLModel, 'reduce_height_depth', 'shape', ShapeReduceHeightWidth)

Possible Predecessors

create_dl_layer_inputcreate_dl_layer_inputCreateDlLayerInputCreateDlLayerInputcreate_dl_layer_input

Possible Successors

create_dl_modelcreate_dl_modelCreateDlModelCreateDlModelcreate_dl_model

Module

Deep Learning Training