create_dl_layer_loss_distanceT_create_dl_layer_loss_distanceCreateDlLayerLossDistanceCreateDlLayerLossDistancecreate_dl_layer_loss_distance (Operator)

Name

create_dl_layer_loss_distanceT_create_dl_layer_loss_distanceCreateDlLayerLossDistanceCreateDlLayerLossDistancecreate_dl_layer_loss_distance — Create a distance loss layer.

Signature

create_dl_layer_loss_distance( : : DLLayerInput, DLLayerTarget, DLLayerWeights, LayerName, DistanceType, LossWeight, GenParamName, GenParamValue : DLLayerLossDistance)

Herror T_create_dl_layer_loss_distance(const Htuple DLLayerInput, const Htuple DLLayerTarget, const Htuple DLLayerWeights, const Htuple LayerName, const Htuple DistanceType, const Htuple LossWeight, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerLossDistance)

void CreateDlLayerLossDistance(const HTuple& DLLayerInput, const HTuple& DLLayerTarget, const HTuple& DLLayerWeights, const HTuple& LayerName, const HTuple& DistanceType, const HTuple& LossWeight, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerLossDistance)

HDlLayer HDlLayer::CreateDlLayerLossDistance(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HString& LayerName, const HString& DistanceType, double LossWeight, const HTuple& GenParamName, const HTuple& GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerLossDistance(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HString& LayerName, const HString& DistanceType, double LossWeight, const HString& GenParamName, const HString& GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerLossDistance(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const char* LayerName, const char* DistanceType, double LossWeight, const char* GenParamName, const char* GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerLossDistance(const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const wchar_t* LayerName, const wchar_t* DistanceType, double LossWeight, const wchar_t* GenParamName, const wchar_t* GenParamValue) const   (Windows only)

static void HOperatorSet.CreateDlLayerLossDistance(HTuple DLLayerInput, HTuple DLLayerTarget, HTuple DLLayerWeights, HTuple layerName, HTuple distanceType, HTuple lossWeight, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerLossDistance)

HDlLayer HDlLayer.CreateDlLayerLossDistance(HDlLayer DLLayerTarget, HDlLayer DLLayerWeights, string layerName, string distanceType, double lossWeight, HTuple genParamName, HTuple genParamValue)

HDlLayer HDlLayer.CreateDlLayerLossDistance(HDlLayer DLLayerTarget, HDlLayer DLLayerWeights, string layerName, string distanceType, double lossWeight, string genParamName, string genParamValue)

def create_dl_layer_loss_distance(dllayer_input: HHandle, dllayer_target: HHandle, dllayer_weights: HHandle, layer_name: str, distance_type: str, loss_weight: float, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[str]) -> HHandle

Description

The operator create_dl_layer_loss_distancecreate_dl_layer_loss_distanceCreateDlLayerLossDistanceCreateDlLayerLossDistanceCreateDlLayerLossDistancecreate_dl_layer_loss_distance creates a distance loss layer whose handle is returned in DLLayerLossDistanceDLLayerLossDistanceDLLayerLossDistanceDLLayerLossDistanceDLLayerLossDistancedllayer_loss_distance.

This layer expects multiple layers as input:

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 LossWeightLossWeightLossWeightLossWeightlossWeightloss_weight is an overall loss weight if there are multiple losses in the network.

The parameter DistanceTypeDistanceTypeDistanceTypeDistanceTypedistanceTypedistance_type determines which distance measure is applied. Currently only 'l2'"l2""l2""l2""l2""l2" is implemented. Depending on the generic parameter 'reduce'"reduce""reduce""reduce""reduce""reduce" this results in

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.

'reduce'"reduce""reduce""reduce""reduce""reduce":

Determines whether the output of the layer is reduced.

Default: 'true'"true""true""true""true""true".

Certain parameters of layers created using this operator create_dl_layer_loss_distancecreate_dl_layer_loss_distanceCreateDlLayerLossDistanceCreateDlLayerLossDistanceCreateDlLayerLossDistancecreate_dl_layer_loss_distance 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
'input_layer'"input_layer""input_layer""input_layer""input_layer""input_layer" (DLLayerInputDLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input, DLLayerTargetDLLayerTargetDLLayerTargetDLLayerTargetDLLayerTargetdllayer_target, or/and DLLayerWeightsDLLayerWeightsDLLayerWeightsDLLayerWeightsDLLayerWeightsdllayer_weights)
'loss_weight'"loss_weight""loss_weight""loss_weight""loss_weight""loss_weight" (LossWeightLossWeightLossWeightLossWeightlossWeightloss_weight)
'name'"name""name""name""name""name" (LayerNameLayerNameLayerNameLayerNamelayerNamelayer_name)
'output_layer'"output_layer""output_layer""output_layer""output_layer""output_layer" (DLLayerLossDistanceDLLayerLossDistanceDLLayerLossDistanceDLLayerLossDistanceDLLayerLossDistancedllayer_loss_distance)
'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"
'reduce'"reduce""reduce""reduce""reduce""reduce"

Execution Information

Parameters

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

Input layer.

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

Target layer.

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

Weights layer.

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

Name of the layer.

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

Type of distance.

Default value: 'l2' "l2" "l2" "l2" "l2" "l2"

List of values: 'l2'"l2""l2""l2""l2""l2"

LossWeightLossWeightLossWeightLossWeightlossWeightloss_weight (input_control)  number HTuplefloatHTupleHtuple (real) (double) (double) (double)

Overall loss weight if there are multiple losses in the network.

Default value: 1.0

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

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

Generic input parameter values.

Default value: []

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

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

Distance loss layer.

Module

Deep Learning Training