Skip to content

create_dl_layer_loss_huberCreateDlLayerLossHuberCreateDlLayerLossHubercreate_dl_layer_loss_huberT_create_dl_layer_loss_huber🔗

Short description🔗

create_dl_layer_loss_huberCreateDlLayerLossHuberCreateDlLayerLossHubercreate_dl_layer_loss_huberT_create_dl_layer_loss_huber — Create a Huber loss layer.

Signature🔗

create_dl_layer_loss_huber( dl_layer DLLayerInput, dl_layer DLLayerTarget, dl_layer DLLayerWeights, dl_layer DLLayerNormalization, string LayerName, number LossWeight, number Beta, attribute.name GenParamName, attribute.value GenParamValue, out dl_layer DLLayerLossHuber )void CreateDlLayerLossHuber( const HTuple& DLLayerInput, const HTuple& DLLayerTarget, const HTuple& DLLayerWeights, const HTuple& DLLayerNormalization, const HTuple& LayerName, const HTuple& LossWeight, const HTuple& Beta, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerLossHuber )static void HOperatorSet.CreateDlLayerLossHuber( HTuple DLLayerInput, HTuple DLLayerTarget, HTuple DLLayerWeights, HTuple DLLayerNormalization, HTuple layerName, HTuple lossWeight, HTuple beta, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerLossHuber )def create_dl_layer_loss_huber( dllayer_input: HHandle, dllayer_target: HHandle, dllayer_weights: HHandle, dllayer_normalization: HHandle, layer_name: str, loss_weight: float, beta: float, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]] ) -> HHandle

Herror T_create_dl_layer_loss_huber( const Htuple DLLayerInput, const Htuple DLLayerTarget, const Htuple DLLayerWeights, const Htuple DLLayerNormalization, const Htuple LayerName, const Htuple LossWeight, const Htuple Beta, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerLossHuber )

HDlLayer HDlLayer::CreateDlLayerLossHuber( const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HDlLayer& DLLayerNormalization, const HString& LayerName, double LossWeight, double Beta, const HTuple& GenParamName, const HTuple& GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerLossHuber( const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HDlLayer& DLLayerNormalization, const HString& LayerName, double LossWeight, double Beta, const HString& GenParamName, const HString& GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerLossHuber( const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HDlLayer& DLLayerNormalization, const char* LayerName, double LossWeight, double Beta, const char* GenParamName, const char* GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerLossHuber( const HDlLayer& DLLayerTarget, const HDlLayer& DLLayerWeights, const HDlLayer& DLLayerNormalization, const wchar_t* LayerName, double LossWeight, double Beta, const wchar_t* GenParamName, const wchar_t* GenParamValue ) const (Windows only)

HDlLayer HDlLayer.CreateDlLayerLossHuber( HDlLayer DLLayerTarget, HDlLayer DLLayerWeights, HDlLayer DLLayerNormalization, string layerName, double lossWeight, double beta, HTuple genParamName, HTuple genParamValue )

HDlLayer HDlLayer.CreateDlLayerLossHuber( HDlLayer DLLayerTarget, HDlLayer DLLayerWeights, HDlLayer DLLayerNormalization, string layerName, double lossWeight, double beta, string genParamName, string genParamValue )

Description🔗

The operator create_dl_layer_loss_huberCreateDlLayerLossHuber creates a Huber loss layer whose handle is returned in DLLayerLossHuberDLLayerLossHuberdllayer_loss_huber. The Huber loss is defined by

\[\begin{eqnarray*} L_{Huber}(x, t, w, n) &:=& \frac{\alpha}{n}\sum_{i=0}^{N-1}w_{i} l(x_{i}-t_{i}), \quad\textnormal{ with }\\ l(y) &:=& \left\{ \begin{array}{ll} 0.5 y^2/\beta & \textnormal{if } |y|<\beta \\ |y|-0.5\beta & \textnormal{else}. \end{array} \right. \end{eqnarray*}\]

This layer expects multiple layers as input:

The underlying data tensors are assumed to be of the same shape with a total number of \(N\) elements.

The parameter DLLayerNormalizationDLLayerNormalizationdllayer_normalization can be used to determine the normalization factor \(n\). If DLLayerNormalizationDLLayerNormalizationdllayer_normalization is set to an empty tuple, the sum over all weights is used for the normalization \(n\).

The parameter LossWeightlossWeightloss_weight determines the scalar weight factor \(\alpha\).

The parameter Betabetabeta sets the value for \(\beta\) in the formula. If Betabetabeta is set to 00, the Huber loss is equal to an L1-loss.

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

The following generic parameters GenParamNamegenParamNamegen_param_name and the corresponding values GenParamValuegenParamValuegen_param_value are supported:

  • 'is_inference_output'"is_inference_output": Determines whether apply_dl_modelApplyDlModel will include the output of this layer in the dictionary DLResultBatchDLResultBatchdlresult_batch even without specifying this layer in Outputsoutputsoutputs ('true'"true") or not ('false'"false").

    Default: 'false'"false"

Certain parameters of layers created using this operator create_dl_layer_loss_huberCreateDlLayerLossHuber can be set and retrieved using further operators. The following tables give an overview, which parameters can be set using set_dl_model_layer_paramSetDlModelLayerParam and which ones can be retrieved using get_dl_model_layer_paramGetDlModelLayerParam or get_dl_layer_paramGetDlLayerParam. Note, the operators set_dl_model_layer_paramSetDlModelLayerParam and get_dl_model_layer_paramGetDlModelLayerParam require a model created by create_dl_modelCreateDlModel.

Layer Parameters set get
'beta'"beta" (Betabetabeta) x x
'input_layer'"input_layer" (DLLayerInputDLLayerInputdllayer_input, DLLayerTargetDLLayerTargetdllayer_target, DLLayerWeightsDLLayerWeightsdllayer_weights, and/or DLLayerNormalizationDLLayerNormalizationdllayer_normalization) x
'loss_weight'"loss_weight" (LossWeightlossWeightloss_weight) x x
'name'"name" (LayerNamelayerNamelayer_name) x x
'output_layer'"output_layer" (DLLayerLossHuberDLLayerLossHuberdllayer_loss_huber) x
'shape'"shape" x
'type'"type" x
Generic Layer Parameters set get
'is_inference_output'"is_inference_output" x x
'num_trainable_params'"num_trainable_params" x

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

DLLayerInputDLLayerInputdllayer_input (input_control) dl_layer → (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)

Input layer.

DLLayerTargetDLLayerTargetdllayer_target (input_control) dl_layer → (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)

Target layer.

DLLayerWeightsDLLayerWeightsdllayer_weights (input_control) dl_layer → (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)

Weights layer.

DLLayerNormalizationDLLayerNormalizationdllayer_normalization (input_control) dl_layer → (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)

Normalization layer.

Default: [][]

LayerNamelayerNamelayer_name (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Name of the output layer.

LossWeightlossWeightloss_weight (input_control) number → (real)HTuple (double)HTuple (double)floatHtuple (double)

Scalar weight factor.

Default: 1.01.0

Betabetabeta (input_control) number → (real)HTuple (double)HTuple (double)floatHtuple (double)

Beta value in the loss-defining formula.

Default: 1.11.1
Restriction: Beta >= 0

GenParamNamegenParamNamegen_param_name (input_control) attribute.name(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Generic input parameter names.

Default: [][]
List of values: 'is_inference_output'"is_inference_output"

GenParamValuegenParamValuegen_param_value (input_control) attribute.value(-array) → (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)MaybeSequence[Union[int, float, str]]Htuple (char* / Hlong / double)

Generic input parameter values.

Default: [][]
Suggested values: 'true', 'false'"true", "false"

DLLayerLossHuberDLLayerLossHuberdllayer_loss_huber (output_control) dl_layer → (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)

Huber loss layer.

Module🔗

Deep Learning Professional