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_elementwiseCreateDlLayerElementwiseCreateDlLayerElementwiseCreateDlLayerElementwisecreate_dl_layer_elementwise creates an element-wise layer whose handle is returned in DLLayerElementWiseDLLayerElementWiseDLLayerElementWiseDLLayerElementWiseDLLayerElementWisedllayer_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.

Depending on OperationOperationOperationOperationoperationoperation, 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 inputs is 1, the values are implicitly duplicated along that dimension to match the shape of the first input. See also the restrictions below.

The parameter DLLayerInputsDLLayerInputsDLLayerInputsDLLayerInputsDLLayerInputsdllayer_inputs determines the feeding input layers.

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 an unique name.

The parameter OperationOperationOperationOperationoperationoperation specifies the operation that is applied. The supported operations are:

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

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

Example: for OperationOperationOperationOperationoperationoperation = 'sum'"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 GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name and the corresponding values GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value are supported:

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

'num_trainable_params'"num_trainable_params""num_trainable_params""num_trainable_params""num_trainable_params""num_trainable_params":

Number of trainable parameters (weights and biases) of the layer.

Certain parameters of layers created using this operator create_dl_layer_elementwisecreate_dl_layer_elementwiseCreateDlLayerElementwiseCreateDlLayerElementwiseCreateDlLayerElementwisecreate_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_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
'coefficients'"coefficients""coefficients""coefficients""coefficients""coefficients" (CoefficientsCoefficientsCoefficientsCoefficientscoefficientscoefficients)
'input_layer'"input_layer""input_layer""input_layer""input_layer""input_layer" (DLLayerInputsDLLayerInputsDLLayerInputsDLLayerInputsDLLayerInputsdllayer_inputs)
'name'"name""name""name""name""name" (LayerNameLayerNameLayerNameLayerNamelayerNamelayer_name)
'operation'"operation""operation""operation""operation""operation" (OperationOperationOperationOperationoperationoperation)
'output_layer'"output_layer""output_layer""output_layer""output_layer""output_layer" (DLLayerElementWiseDLLayerElementWiseDLLayerElementWiseDLLayerElementWiseDLLayerElementWisedllayer_element_wise)
'shape'"shape""shape""shape""shape""shape"
'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

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

Feeding input layers.

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

Name of the layer.

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

Element-wise operations.

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

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

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

Optional input tensor coefficients.

Default value: []

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

Generic input parameter names.

Default value: []

List of values: '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 value: []

Suggested values: 'true'"true""true""true""true""true", 'false'"false""false""false""false""false"

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

Elementwise layer.

Module

Deep Learning Training