Skip to content

create_dl_layer_softmaxCreateDlLayerSoftmaxCreateDlLayerSoftmaxcreate_dl_layer_softmaxT_create_dl_layer_softmax🔗

Short description🔗

create_dl_layer_softmaxCreateDlLayerSoftmaxCreateDlLayerSoftmaxcreate_dl_layer_softmaxT_create_dl_layer_softmax — Create a softmax layer.

Signature🔗

create_dl_layer_softmax( dl_layer DLLayerInput, string LayerName, attribute.name GenParamName, attribute.value GenParamValue, out dl_layer DLLayerSoftMax )void CreateDlLayerSoftmax( const HTuple& DLLayerInput, const HTuple& LayerName, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerSoftMax )static void HOperatorSet.CreateDlLayerSoftmax( HTuple DLLayerInput, HTuple layerName, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerSoftMax )def create_dl_layer_softmax( dllayer_input: HHandle, layer_name: str, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]] ) -> HHandle

Herror T_create_dl_layer_softmax( const Htuple DLLayerInput, const Htuple LayerName, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerSoftMax )

HDlLayer HDlLayer::CreateDlLayerSoftmax( const HString& LayerName, const HTuple& GenParamName, const HTuple& GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerSoftmax( const HString& LayerName, const HString& GenParamName, const HString& GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerSoftmax( const char* LayerName, const char* GenParamName, const char* GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerSoftmax( const wchar_t* LayerName, const wchar_t* GenParamName, const wchar_t* GenParamValue ) const (Windows only)

HDlLayer HDlLayer.CreateDlLayerSoftmax( string layerName, HTuple genParamName, HTuple genParamValue )

HDlLayer HDlLayer.CreateDlLayerSoftmax( string layerName, string genParamName, string genParamValue )

Description🔗

The operator create_dl_layer_softmaxCreateDlLayerSoftmax creates a softmax layer whose handle is returned in DLLayerSoftMaxDLLayerSoftMaxdllayer_soft_max.

The parameter DLLayerInputDLLayerInputdllayer_input determines the feeding input layer and expects the layer handle as value.

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 softmax layer applies the softmax function which is defined for each input \(x_{i}\) as follows:

\[\begin{eqnarray*} Softmax(x_{i})=\frac{\exp(x_{i})}{\sum_{j=0}^{N-1} \exp(x_{j})} \end{eqnarray*}\]

where \(N\) is the number of inputs. During training, the result of the softmax function is transformed by a logarithm function, such that the values are suitable as input to e.g., a cross entropy loss layer. This behavior can be changed by setting the generic parameter 'output_mode'"output_mode", see below.

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

  • 'output_mode'"output_mode": This parameter determines if and in which case the output is transformed by a logarithm function:

    • 'default'"default": During inference, the result of the softmax function is returned as output while during training, the softmax is further transformed by a logarithm function.

    • 'no_log_training'"no_log_training": During training the result of the softmax function is not transformed by a logarithm function.

    • 'log_inference'"log_inference": The logarithm of the softmax is calculated during inference in the same way as during training.

    Default: 'default'"default".

  • '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_softmaxCreateDlLayerSoftmax 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
'input_layer'"input_layer" (DLLayerInputDLLayerInputdllayer_input) x
'name'"name" (LayerNamelayerNamelayer_name) x x
'output_layer'"output_layer" (DLLayerSoftMaxDLLayerSoftMaxdllayer_soft_max) 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
'output_mode'"output_mode" 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)

Feeding layer.

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

Name of the output layer.

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', 'output_mode'"is_inference_output", "output_mode"

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: 'default', 'no_log_training', 'log_inference', 'true', 'false'"default", "no_log_training", "log_inference", "true", "false"

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

Softmax layer.

Module🔗

Deep Learning Professional