create_dl_layer_softmaxCreateDlLayerSoftmaxCreateDlLayerSoftmaxcreate_dl_layer_softmaxT_create_dl_layer_softmax
説明
create_dl_layer_softmaxCreateDlLayerSoftmaxCreateDlLayerSoftmaxcreate_dl_layer_softmaxT_create_dl_layer_softmax — ソフトマックス層(Softmax Layer)を生成する。
書式
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 )
説明
create_dl_layer_softmaxCreateDlLayerSoftmax は、ソフトマックス層を生成し、
そのハンドルをDLLayerSoftMaxDLLayerSoftMaxdllayer_soft_max に返します。
パラメーター DLLayerInputDLLayerInputdllayer_input は、値として層のハンドルを受け取り、入力される層を決定します。
パラメーター LayerNamelayerNamelayer_name は、個々の層の名前を設定します。
create_dl_modelCreateDlModel によってモデルを生成する場合、生成されるネットワークの各層には固有の名前が必要です。
ソフトマックス層では、各入力 \(x_{i}\) に対して、
以下のように定義されるソフトマックス関数を適用します。
\[\begin{eqnarray*}
Softmax(x_{i})=\frac{\exp(x_{i})}{\sum_{j=0}^{N-1} \exp(x_{j})}
\end{eqnarray*}\]
ここで、\(N\) は入力の数です。
学習時には、ソフトマックス関数の結果に対して、さらに対数関数によって変換され、
交差エントロピー誤差層などへの入力として適した値とします。
この動作は、一般パラメーター 'output_mode'"output_mode" の設定によって変更できます。
以下の一般パラメーター GenParamNamegenParamNamegen_param_name と、対応する値 GenParamValuegenParamValuegen_param_value がサポートされています。
-
'output_mode'"output_mode":
このパラメーターは、出力結果を対数関数で変換するかどうか、
またどのように場合に変換するかを決定します。
-
'default'"default":
推論時には、ソフトマックス関数の結果が出力として返され、
学習時には、対数関数によってさらに変換されます。
-
'no_log_training'"no_log_training":
学習時には、ソフトマックス関数の結果は対数関数で変換されません。
-
'log_inference'"log_inference":
推論時と学習時、どちらでもソフトマックスの対数が計算されます。
初期値: 'default'"default".
-
'is_inference_output'"is_inference_output":
apply_dl_modelApplyDlModel が Outputsoutputsoutputs としてこの層を指定していなくても、
ディクショナリ DLResultBatchDLResultBatchdlresult_batch にこの層の出力を含めるか ('true'"true")、
含めないか ('false'"false") を設定します。
初期値: 'false'"false"
create_dl_layer_softmaxCreateDlLayerSoftmax によって生成された層の一部のパラメーターは、
他のオペレーターによって値をセットしたり、取得することができます。
次の表は、どのパラメーターが set_dl_model_layer_paramSetDlModelLayerParam を使って設定でき、
どのパラメーターが get_dl_model_layer_paramGetDlModelLayerParam や get_dl_layer_paramGetDlLayerParam を使って
取得できるのか、概要を示しています。
なお、オペレーター set_dl_model_layer_paramSetDlModelLayerParam と get_dl_model_layer_paramGetDlModelLayerParam には、
create_dl_modelCreateDlModel で生成されたモデルを要求します。
| 汎用層パラメーター |
set |
get |
| 'is_inference_output'"is_inference_output" |
x |
x |
| 'num_trainable_params'"num_trainable_params" |
|
x |
| 'output_mode'"output_mode" |
|
x |
実行情報
実行情報
パラメーター
DLLayerInputDLLayerInputdllayer_input (input_control) dl_layer → (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)
入力される層
LayerNamelayerNamelayer_name (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)
出力層の名前
GenParamNamegenParamNamegen_param_name (input_control) attribute.name(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)
一般パラメーターの名前
初期値: [][]
値のリスト: '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)
一般パラメーターの値
初期値: [][]
推奨値: '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)
ソフトマックス層
モジュール
Deep Learning Professional