create_dl_layer_elementwiseT_create_dl_layer_elementwiseCreateDlLayerElementwiseCreateDlLayerElementwisecreate_dl_layer_elementwise (Operator)

Name

create_dl_layer_elementwiseT_create_dl_layer_elementwiseCreateDlLayerElementwiseCreateDlLayerElementwisecreate_dl_layer_elementwise — Create an elementwise layer.

Signature

create_dl_layer_elementwise( : : DLLayerInputs, LayerName, Operation, Coefficients, GenParamName, GenParamValue : DLLayerElementWise)

Herror T_create_dl_layer_elementwise(const Htuple DLLayerInputs, const Htuple LayerName, const Htuple Operation, const Htuple Coefficients, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerElementWise)

void CreateDlLayerElementwise(const HTuple& DLLayerInputs, const HTuple& LayerName, const HTuple& Operation, const HTuple& Coefficients, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerElementWise)

static HDlLayer HDlLayer::CreateDlLayerElementwise(const HDlLayerArray& DLLayerInputs, const HString& LayerName, const HString& Operation, const HTuple& Coefficients, const HTuple& GenParamName, const HTuple& GenParamValue)

HDlLayer HDlLayer::CreateDlLayerElementwise(const HString& LayerName, const HString& Operation, double Coefficients, const HString& GenParamName, const HString& GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerElementwise(const char* LayerName, const char* Operation, double Coefficients, const char* GenParamName, const char* GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerElementwise(const wchar_t* LayerName, const wchar_t* Operation, double Coefficients, const wchar_t* GenParamName, const wchar_t* GenParamValue) const   ( Windows only)

static void HOperatorSet.CreateDlLayerElementwise(HTuple DLLayerInputs, HTuple layerName, HTuple operation, HTuple coefficients, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerElementWise)

static HDlLayer HDlLayer.CreateDlLayerElementwise(HDlLayer[] DLLayerInputs, string layerName, string operation, HTuple coefficients, HTuple genParamName, HTuple genParamValue)

HDlLayer HDlLayer.CreateDlLayerElementwise(string layerName, string operation, double coefficients, string genParamName, string genParamValue)

def create_dl_layer_elementwise(dllayer_inputs: MaybeSequence[HHandle], layer_name: str, operation: str, coefficients: MaybeSequence[float], gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]]) -> HHandle

Description

The operator create_dl_layer_elementwisecreate_dl_layer_elementwiseCreateDlLayerElementwiseCreateDlLayerElementwisecreate_dl_layer_elementwise creates an element-wise layer whose handle is returned in DLLayerElementWiseDLLayerElementWiseDLLayerElementWiseDLLayerElementWisedllayer_element_wise.

An elementwise layer applies a certain operation to every data tensor of the input layers handles and to each element of the data tensor. As a consequence, all input data tensors should be of the same shape and the output tensor has the same shape as the first input tensor.

The parameter DLLayerInputsDLLayerInputsDLLayerInputsDLLayerInputsdllayer_inputs determines the feeding input layers. This layer expects multiple layers as input. For OperationOperationOperationoperationoperation = 'division'"division""division""division""division" exactly two input layers are expected.

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. Depending on OperationOperationOperationoperationoperation, the layer supports implicit broadcasting. I.e., if one of the shape dimensions (batch_size, depth, height, width) of the second or any of the following input tensors is 1, the values are implicitly multiplied along that dimension to match the shape of the first input. The supported values are:

The optional parameter CoefficientsCoefficientsCoefficientscoefficientscoefficients determines a weighting coefficient for every input tensor. The number of values in CoefficientsCoefficientsCoefficientscoefficientscoefficients must match the number of feeding layers in DLLayerInputsDLLayerInputsDLLayerInputsDLLayerInputsdllayer_inputs. Set CoefficientsCoefficientsCoefficientscoefficientscoefficients equal to [] if no coefficients shall be used in the element-wise operation.

Restriction: No coefficients can be set for OperationOperationOperationoperationoperation = 'product'"product""product""product""product".

Example: for OperationOperationOperationoperationoperation = 'sum'"sum""sum""sum""sum", the -th element of the output data tensor is given by where is the number of input data tensors.

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

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

Small scalar value that is added to the elements of the denominator to avoid a division by zero (for OperationOperationOperationoperationoperation = 'division'"division""division""division""division").

Default: 1e-10

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

Certain parameters of layers created using this operator create_dl_layer_elementwisecreate_dl_layer_elementwiseCreateDlLayerElementwiseCreateDlLayerElementwisecreate_dl_layer_elementwise 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
'coefficients'"coefficients""coefficients""coefficients""coefficients" (CoefficientsCoefficientsCoefficientscoefficientscoefficients) x
'input_layer'"input_layer""input_layer""input_layer""input_layer" (DLLayerInputsDLLayerInputsDLLayerInputsDLLayerInputsdllayer_inputs) 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" (DLLayerElementWiseDLLayerElementWiseDLLayerElementWiseDLLayerElementWisedllayer_element_wise) x
'shape'"shape""shape""shape""shape" x
'type'"type""type""type""type" x
Generic Layer Parameters set get
'div_eps'"div_eps""div_eps""div_eps""div_eps" x x
'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

Execution Information

Parameters

DLLayerInputsDLLayerInputsDLLayerInputsDLLayerInputsdllayer_inputs (input_control)  dl_layer(-array) HDlLayer, HTupleMaybeSequence[HHandle]HTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Feeding input layers.

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

Name of the output layer.

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

Element-wise operations.

Default: 'sum' "sum" "sum" "sum" "sum"

List of values: 'division'"division""division""division""division", 'maximum'"maximum""maximum""maximum""maximum", 'minimum'"minimum""minimum""minimum""minimum", 'product'"product""product""product""product", 'sum'"sum""sum""sum""sum"

CoefficientsCoefficientsCoefficientscoefficientscoefficients (input_control)  number(-array) HTupleMaybeSequence[float]HTupleHtuple (real) (double) (double) (double)

Optional input tensor coefficients.

Default: []

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

Generic input parameter names.

Default: []

List of values: '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: 'true'"true""true""true""true", 'false'"false""false""false""false"

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

Elementwise layer.

Module

Deep Learning Professional