Skip to content

create_dl_layer_elementwiseCreateDlLayerElementwiseCreateDlLayerElementwisecreate_dl_layer_elementwiseT_create_dl_layer_elementwise🔗

説明🔗

create_dl_layer_elementwiseCreateDlLayerElementwiseCreateDlLayerElementwisecreate_dl_layer_elementwiseT_create_dl_layer_elementwise — Elementwise層を作成する。

書式🔗

create_dl_layer_elementwise( dl_layer DLLayerInputs, string LayerName, string Operation, number Coefficients, attribute.name GenParamName, attribute.value GenParamValue, out dl_layer DLLayerElementWise )void CreateDlLayerElementwise( const HTuple& DLLayerInputs, const HTuple& LayerName, const HTuple& Operation, const HTuple& Coefficients, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerElementWise )static void HOperatorSet.CreateDlLayerElementwise( HTuple DLLayerInputs, HTuple layerName, HTuple operation, HTuple coefficients, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerElementWise )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

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 )

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 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 )

説明🔗

オペレーター create_dl_layer_elementwiseCreateDlLayerElementwiseは ハンドルがDLLayerElementWiseDLLayerElementWisedllayer_element_wiseに返される Elementwise層を作成します。

Elementwise層は、インプット層ハンドルの全てのデータテンソルとデータテンソルの各要素に特定の操作を適用します。 結果として、全ての入力データテンソルは同じ形式である必要があり、出力テンソルは最初に入力されたテンソルと同じ形式となります。

パラメーター DLLayerInputsDLLayerInputsdllayer_inputsは入力される層を決定します。 この層は複数の層を入力として期待しています。Operationoperationoperation = 'division'"division" の場合、2つの入力層が期待されます。

LayerNamelayerNamelayer_name は個々の層の名前を設定します。 create_dl_modelCreateDlModel を使ってモデルを作成する場合、作成されるネットワークの 各層には固有の名前が必要であることに注意してください。

Operationoperationoperation は適用される操作を指定します。Operationoperationoperation に応じて、 レイヤーは暗黙的な一方向ブロードキャストをサポートします。つまり、出力形状(batch_size, depth, height, width) と同じ「完全な」形状を持つ入力が1つ必要です。その他の入力は、各次元について、その次元と同じサイズ、または1を持つことができます。いずれかの次元が1の場合、 値は完全な形状に合わせて、その次元に沿って暗黙的にブロードキャストされます。 サポートされている値は次の通りです。:

  • 'division'"division": 要素ごとの除算。ブロードキャストは対応していますが、最初の入力から2番目の入力へのみ可能です。つまり、最初の入力は完全な形状である必要があります。

  • 'maximum'"maximum": Elementwiseの最大値。ブロードキャストは全て対応しています。

  • 'minimum'"minimum": Elementwiseの最小値。 ブロードキャストは全て対応しています。

  • 'product'"product": Elementwiseの積。ブロードキャストは対応していますが、完全な形状を持たないすべての入力は同じ形状でなければなりません。すべての入力が完全な形状を持つか、または1つの入力だけが完全な形状を持つかのいずれかです。

  • 'sum'"sum": Elementwiseの総和。ブロードキャストは全て対応しています。

ブロードキャストは、同じ形状を持つすべての入力よりも遅くなる可能性があることに注意してください。

オプションパラメーター Coefficientscoefficientscoefficientsは、全ての入力テンソルの重み係数を決定します。 Coefficientscoefficientscoefficientsの値の数はDLLayerInputsDLLayerInputsdllayer_inputsの入力される層の数と一致する必要があります。 Elementwiseの演算で係数を使用しない場合は、 Coefficientscoefficientscoefficientsには'[]'"[]"を設定します。

制限: Operationoperationoperation = 'product'"product"の場合には係数を設定できません。

例:Operationoperationoperation = 'sum'"sum"の場合、 出力データテンソルの\(i\)-th 番目の要素は以下で与えられます。

\[\begin{eqnarray*} output[i] = \sum_{n=0}^{N-1}\textrm{Coefficients}[n] \cdot \textrm{DLLayerInputs}_{n}[i], \end{eqnarray*}\]

ここでN\(N\) は入力データテンソルの数です。

次の汎用パラメーター GenParamNamegenParamNamegen_param_name及び対応する値 GenParamValuegenParamValuegen_param_valueがサポートされています。:

  • 'div_eps'"div_eps": 0による除算(Operationoperationoperation = 'division'"division"の場合)を避けるために分母の要素に追加される小さなスカラー値。

    初期値: 1e-101e-10

  • 'is_inference_output'"is_inference_output": オペレーター apply_dl_modelApplyDlModel がOutputsoutputsoutputs でこのレイヤを指定していない場合であっても、 ディクショナリ DLResultBatchDLResultBatchdlresult_batch に、この層の出力を含む('true'"true")か 含まない ('false'"false")かを決定します。

    初期値: 'false'"false"

このオペレーターcreate_dl_layer_elementwiseCreateDlLayerElementwiseを使って作成された層の特定のパラメーターは、 他のオペレーターによって値を設定や取得ができます。 次の表は、どのパラメーターが 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
'coefficients'"coefficients" (Coefficientscoefficientscoefficients) x x
'input_layer'"input_layer" (DLLayerInputsDLLayerInputsdllayer_inputs) x
'name'"name" (LayerNamelayerNamelayer_name) x x
'operation'"operation" (Operationoperationoperation) x
'output_layer'"output_layer" (DLLayerElementWiseDLLayerElementWisedllayer_element_wise) x
'shape'"shape" x
'type'"type" x
汎用的な層パラメーター set get
'div_eps'"div_eps" x x
'is_inference_output'"is_inference_output" x x
'num_trainable_params'"num_trainable_params" x

実行情報🔗

実行情報
  • マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)

  • マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)

  • 並列演算処理には未対応

パラメーター🔗

DLLayerInputsDLLayerInputsdllayer_inputs (input_control) dl_layer(-array) → (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)MaybeSequence[HHandle]Htuple (handle)

入力として与えられる層

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

アウトプット層の名前

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

Element-wiseの操作.

初期値: 'sum'"sum"
値のリスト: 'division', 'maximum', 'minimum', 'product', 'sum'"division", "maximum", "minimum", "product", "sum"

Coefficientscoefficientscoefficients (input_control) number(-array) → (real)HTuple (double)HTuple (double)MaybeSequence[float]Htuple (double)

オプションの入力テンソル係数

初期値: [][]

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

汎用パラメーターの名前

初期値: [][]
値のリスト: '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)

汎用パラメーターの値

初期値: [][]
推奨値: 'true', 'false'"true", "false"

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

Elementwise層

モジュール🔗

Deep Learning Professional