Skip to content

create_dl_layer_reduceCreateDlLayerReduceCreateDlLayerReducecreate_dl_layer_reduceT_create_dl_layer_reduce🔗

説明🔗

create_dl_layer_reduceCreateDlLayerReduceCreateDlLayerReducecreate_dl_layer_reduceT_create_dl_layer_reduce — reduceレイヤーを作成する。

書式🔗

create_dl_layer_reduce( dl_layer DLLayerInput, string LayerName, string Operation, integer Axes, attribute.name GenParamName, attribute.value GenParamValue, out dl_layer DLLayerReduce )void CreateDlLayerReduce( const HTuple& DLLayerInput, const HTuple& LayerName, const HTuple& Operation, const HTuple& Axes, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerReduce )static void HOperatorSet.CreateDlLayerReduce( HTuple DLLayerInput, HTuple layerName, HTuple operation, HTuple axes, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerReduce )def create_dl_layer_reduce( dllayer_input: HHandle, layer_name: str, operation: str, axes: MaybeSequence[Union[int, str]], gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]] ) -> HHandle

Herror T_create_dl_layer_reduce( const Htuple DLLayerInput, const Htuple LayerName, const Htuple Operation, const Htuple Axes, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerReduce )

HDlLayer HDlLayer::CreateDlLayerReduce( const HString& LayerName, const HString& Operation, const HTuple& Axes, const HTuple& GenParamName, const HTuple& GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerReduce( const HString& LayerName, const HString& Operation, Hlong Axes, const HString& GenParamName, const HString& GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerReduce( const char* LayerName, const char* Operation, Hlong Axes, const char* GenParamName, const char* GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerReduce( const wchar_t* LayerName, const wchar_t* Operation, Hlong Axes, const wchar_t* GenParamName, const wchar_t* GenParamValue ) const (Windows only)

HDlLayer HDlLayer.CreateDlLayerReduce( string layerName, string operation, HTuple axes, HTuple genParamName, HTuple genParamValue )

HDlLayer HDlLayer.CreateDlLayerReduce( string layerName, string operation, int axes, string genParamName, string genParamValue )

説明🔗

オペレータ create_dl_layer_reduceCreateDlLayerReduce はreduceレイヤーを作成し、 そのハンドルは DLLayerReduceDLLayerReducedllayer_reduce に返されます。

reduceレイヤーは与えられた入力テンソルを1つまたは複数の軸に沿って1つの値に削減します。 それゆえ、出力テンソルは入力テンソルとして同じ形状を持ちますが、 Axesaxesaxes で与えられる軸では、次元が1になります。

パラメータ DLLayerInputDLLayerInputdllayer_input は入力として与えられるレイヤーを決定します。 このレイヤーは入力として1つのレイヤーを想定しています。

パラメータ LayerNamelayerNamelayer_name は個々のレイヤーの名前を設定します。 ただし、 create_dl_modelCreateDlModel を使用してモデルを作成する場合、 作成されたネットワークの各レイヤーは独自の名前を持つ必要があります。

パラメータ Operationoperationoperation は適用される操作を指定します。 操作は、入力テンソルの Axesaxesaxes で指定された軸に沿った値に適用され、 結果は、出力テンソルの対応する位置に書き込まれます。 Operationoperationoperationは次の値がサポートされています。:

  • 'norm_l2'"norm_l2": 入力値のL2ノルムを計算します。

  • 'sum'"sum": 入力値の合計を計算します。

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

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

  • 'div_eps'"div_eps": 学習を安定させるために使用される小さなスカラ値です。 ゼロ除算を防ぐために分母にこの値が加えられます。 初期値: 1e-101e-10

このオペレータ create_dl_layer_reduceCreateDlLayerReduce を使用して作成されたレイヤーの特定のパラメータは、 追加のオペレータを用いて設定や取得が可能です。 以下の表は 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
'axes'"axes" (Axesaxesaxes) x
'input_layer'"input_layer" (DLLayerInputDLLayerInputdllayer_input) x
'name'"name" (LayerNamelayerNamelayer_name) x x
'operation'"operation" (Operationoperationoperation) x
'output_layer'"output_layer" (DLLayerReduceDLLayerReducedllayer_reduce) x
'shape'"shape" x
'type'"type" x
汎用レイヤーパラメータ set get
'is_inference_output'"is_inference_output" x x
'num_trainable_params'"num_trainable_params" x
'div_eps'"div_eps" 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*)

出力レイヤーの名前

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

Reduce演算.

初期値: 'norm_l2'"norm_l2"
値のリスト: 'norm_l2', 'sum'"norm_l2", "sum"

Axesaxesaxes (input_control) integer(-array) → (integer / string)HTuple (Hlong / HString)HTuple (int / long / string)MaybeSequence[Union[int, str]]Htuple (Hlong / char*)

Reduce演算が適用される軸

初期値: [2, 3][2, 3]
値のリスト: 0, 1, 2, 3, 'batch', 'depth', 'height', 'width'0, 1, 2, 3, "batch", "depth", "height", "width"

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

汎用パラメータの名前

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

汎用パラメータの値

初期値: [][]
推奨値: 1e-10, 'true', 'false'1e-10, "true", "false"

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

Reduceレイヤー

例🔗

(HDevelop)


* Minimal example for reduce-layer.
create_dl_layer_input ('input', [64, 32, 10], [], [], DLLayerInput)
create_dl_layer_reduce (DLLayerInput, 'reduce_width', 'sum', 'width', [], [], \
                         DLLayerReduceWidth)
create_dl_layer_reduce (DLLayerReduceWidth, 'reduce_height_depth', 'norm_l2',  [1,2], [], \
                         [], DLLayerReduceHeightDepth)
* Create a model and change the batch-size.
create_dl_model (DLLayerReduceHeightDepth, DLModel)
set_dl_model_param (DLModel, 'batch_size', 2)
get_dl_model_layer_param (DLModel, 'reduce_height_depth', 'shape', ShapeReduceHeightWidth)

他のオペレーターとの組み合わせ🔗

組み合わせ

前処理の候補

create_dl_layer_inputCreateDlLayerInput

後処理の候補

create_dl_modelCreateDlModel

モジュール🔗

Deep Learning Professional