Skip to content

create_dl_layer_inputCreateDlLayerInputCreateDlLayerInputcreate_dl_layer_inputT_create_dl_layer_input🔗

説明🔗

create_dl_layer_inputCreateDlLayerInputCreateDlLayerInputcreate_dl_layer_inputT_create_dl_layer_input — 入力層を作成します。

書式🔗

create_dl_layer_input( string LayerName, number Shape, attribute.name GenParamName, attribute.value GenParamValue, out dl_layer DLLayerInput )void CreateDlLayerInput( const HTuple& LayerName, const HTuple& Shape, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerInput )static void HOperatorSet.CreateDlLayerInput( HTuple layerName, HTuple shape, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerInput )def create_dl_layer_input( layer_name: str, shape: Sequence[int], gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]] ) -> HHandle

Herror T_create_dl_layer_input( const Htuple LayerName, const Htuple Shape, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerInput )

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

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

void HDlLayer::HDlLayer( const char* LayerName, const HTuple& Shape, const char* GenParamName, const char* GenParamValue )

void HDlLayer::HDlLayer( const wchar_t* LayerName, const HTuple& Shape, const wchar_t* GenParamName, const wchar_t* GenParamValue ) (Windows only)

public HDlLayer( string layerName, HTuple shape, HTuple genParamName, HTuple genParamValue )

public HDlLayer( string layerName, HTuple shape, string genParamName, string genParamValue )

void HDlLayer::CreateDlLayerInput( const HString& LayerName, const HTuple& Shape, const HTuple& GenParamName, const HTuple& GenParamValue )

void HDlLayer::CreateDlLayerInput( const HString& LayerName, const HTuple& Shape, const HString& GenParamName, const HString& GenParamValue )

void HDlLayer::CreateDlLayerInput( const char* LayerName, const HTuple& Shape, const char* GenParamName, const char* GenParamValue )

void HDlLayer::CreateDlLayerInput( const wchar_t* LayerName, const HTuple& Shape, const wchar_t* GenParamName, const wchar_t* GenParamValue ) (Windows only)

void HDlLayer.CreateDlLayerInput( string layerName, HTuple shape, HTuple genParamName, HTuple genParamValue )

void HDlLayer.CreateDlLayerInput( string layerName, HTuple shape, string genParamName, string genParamValue )

説明🔗

オペレーター create_dl_layer_inputCreateDlLayerInput はShapeshapeshape に与えられた空間次元から 入力層を作成し、 DLLayerInputDLLayerInputdllayer_input にハンドルを返します。

パラメーター LayerNamelayerNamelayer_name は個々の層名を設定します。 オペレーター create_dl_modelCreateDlModel を使用してモデルを生成する場合、作成された ネットワークの各層には一意の名前が必要であることに注意してください。

モデルが create_dl_modelCreateDlModel によって作成されたら、バッチサイズを オペレーター set_dl_model_paramSetDlModelParamで設定する必要があります。

作成されたモデルが apply_dl_modelApplyDlModel やtrain_dl_model_batchTrainDlModelBatch などを使用して適用される場合、対応する入力層に入力をマップすることが可能である必要があります。 モデルを適用するオペレーターは、入力として与えられるディクショナリ DLSampleを 期待します。Deep Learning / Model を参照してください。 上記マッピングはキーが入力層名と一致するディクショナリを使用して行われます。 したがってこの層の入力のために、サンプルディクショナリにはキー LayerNamelayerNamelayer_name のエントリが必要です。('input_type'"input_type" が 'constant'"constant"に 設定されている場合を除く。以下を参照してください。)

パラメーター Shapeshapeshapeは、入力値(入力として与えられたディクショナリDLSample)の値)の形状を指定します。そして、入力のwidth, height, depthを含む、長さが3のtupleである必要があります。このtupleの値は整数で与えられる必要があり、入力型に応じて、意味合いが異なります。:

  • 入力画像に対して層 Shapeshapeshape は画像サイズを設定します。 画像はreal型で与えられます。(画像タイプは Imageを参照してください。)

  • 入力tupleに対して、その長さと Shapeshapeshapeのそれぞれの値の積, つまり width \(\times\) height \(\times\) depth を一致させる必要があります。 Tupleの値は column- (width), row- (height), and depth-軸 の順に与えられます。

    Tupleの入力値はint型かreal型で与えられます。

バッチサイズは、create_dl_modelCreateDlModelでモデルが作成された後に、set_dl_model_paramSetDlModelParamで設定する必要があります。 汎用パラメーター GenParamNamegenParamNamegen_param_name 及び対応する値 GenParamValuegenParamValuegen_param_value は以下がサポートされています。:

  • 'allow_smaller_tuple'"allow_smaller_tuple": Tuple入力の場合、 'allow_smaller_tuple'"allow_smaller_tuple" に 'true'"true" を設定すると、 Shapeshapeshapeで与えられた全寸法以下の入力Tupleを持つことを許容します。 例えば、入力が画像中のオブジェクト数に対応するとオブジェクト数は画像で 変化します。 Shapeshapeshapeの寸法の最大数以下の場合、残りは0に設定されます。

    Shapeshapeshape は最大予測長さのように設定されます。例えばそれは全データセット の中の、ある画像中のオブジェクトの最大数になります。

    初期値: 'false'"false".

  • 'const_val'"const_val": 一定の出力値。 (以下参照)

    制限: 整数または浮動小数のみ設定可能です。'input_type'"input_type" を 'constant'"constant"に 設定する場合のみ、この値の設定と取得が可能です。

    初期値: 0.00.0.

  • 'input_type'"input_type": 期待される入力のtypeを定義します。 以下の値が設定可能です。:

    • 'default'"default": この層は、バッチサイズに対応した数の入力画像を想定しています。

    • 'region_to_bin'"region_to_bin": 層はregionのtupleを入力として期待し、 それぞれの領域に対して一つのdepthチャンネルに符号化されているバイナリ画像に内部的に変換します。 指定した寸法に達した領域は Shapeshapeshapeで設定された幅と高さの範囲で 切り取られます。領域の最大数は Shapeshapeshapeの深さで定義されます。 領域の最大数以下が設定されると、出力は空(0)で埋められた画像となります。例えば、 領域がある画像中のオブジェクトに対応していて、オブジェクトの数が 画像ごとに変化する場合などのケースです。。

    • 'constant'"constant": 層は与えられたディクショナリにあるこの入力層の キーと値のペアを期待しません。代わりにこの層の出力の全てのエントリに 'const_val'"const_val"の値が与えられます。

    初期値: 'default'"default".

  • 'keep_batch_size_const'"keep_batch_size_const": 定数入力の場合、このパラメータを'true'"true"に設定すると、モデルのバッチサイズ変更に関わらず、 入力のバッチサイズを常に一定に保つことができます。 初期値: 'false'"false".

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

    初期値: 'false'"false"

create_dl_layer_inputCreateDlLayerInput を使って生成された層パラメーターのいくつかは、 追加のオペレーターを使用して設定や取得ができます。 以下の表は 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
'input_layer'"input_layer" x
'name'"name" (LayerNamelayerNamelayer_name) x x
'output_layer'"output_layer" (DLLayerInputDLLayerInputdllayer_input) x
'shape'"shape" (Shapeshapeshape) x
'type'"type" x
汎用層パラメーター set get
'allow_smaller_tuple'"allow_smaller_tuple" x
'const_val'"const_val" (x) (x)
'input_type'"input_type" x
'keep_batch_size_const'"keep_batch_size_const" x x
'is_inference_output'"is_inference_output" x x
'num_trainable_params'"num_trainable_params" x

実行情報🔗

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

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

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

このオペレータはハンドルを返します。このハンドルタイプのインスタンスの状態は、特定のオペレータにおいては、入力パラメータとして使われている場合であっても変更されることがあります。

パラメーター🔗

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

出力層名

Shapeshapeshape (input_control) number-array → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

入力寸法 (width, height, depth)

初期値: [224, 224, 3][224, 224, 3]

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

汎用入力パラメーター名

初期値: [][]
値のリスト: 'allow_smaller_tuple', 'const_val', 'input_type', 'is_inference_output', 'keep_batch_size_const'"allow_smaller_tuple", "const_val", "input_type", "is_inference_output", "keep_batch_size_const"

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)

汎用入力パラメーター値

初期値: [][]
推奨値: 0.0, 'constant', 'default', 'false', 'region_to_bin', 'true'0.0, "constant", "default", "false", "region_to_bin", "true"

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

入力層

例🔗

(HDevelop)


* Create a model for summation.
create_dl_layer_input ('input_a', [2, 3, 4], [], [], DLLayerInputA)
create_dl_layer_input ('input_b', [2, 3, 4], [], [], DLLayerInputB)
create_dl_layer_elementwise ([DLLayerInputA, DLLayerInputB], 'sum', \
                              'sum', [], [], [], DLLayerElementWise)
create_dl_model (DLLayerElementWise, DLModel)
set_dl_model_param (DLModel, 'runtime', 'cpu')
*
* Add 'input_a' as an inference model output.
set_dl_model_layer_param (DLModel, 'input_a', 'is_inference_output', 'true')
*
* Feed input data as tuple (a) or image (b).
create_dict (Sample)
set_dict_tuple (Sample, 'input_a', [1:(2*3*4)])
gen_empty_obj (InputB)
for I := 1 to 4 by 1
    gen_image_const (Channel, 'real', 2, 3)
    get_region_points (Channel, Rows, Cols)
    set_grayval (Channel, Rows, Cols, gen_tuple_const(|Rows|, I))
    append_channel (InputB, Channel, InputB)
endfor
set_dict_object (InputB, Sample, 'input_b')
*
* Apply the model for summation and get results.
set_dl_model_param (DLModel, 'batch_size', 2)
apply_dl_model (DLModel, [Sample,Sample], [], Result)
get_dict_object (Sum, Result[0], 'sum')
get_dict_object (TupleInputA, Result[1], 'input_a')

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

組み合わせ

後処理の候補

create_dl_layer_activationCreateDlLayerActivation, create_dl_layer_batch_normalizationCreateDlLayerBatchNormalization, create_dl_layer_class_id_conversionCreateDlLayerClassIdConversion, create_dl_layer_class_id_conversionCreateDlLayerClassIdConversion, create_dl_layer_concatCreateDlLayerConcat, create_dl_layer_convolutionCreateDlLayerConvolution, create_dl_layer_denseCreateDlLayerDense, create_dl_layer_depth_maxCreateDlLayerDepthMax, create_dl_layer_dropoutCreateDlLayerDropout, create_dl_layer_elementwiseCreateDlLayerElementwise, create_dl_layer_loss_cross_entropyCreateDlLayerLossCrossEntropy, create_dl_layer_loss_ctcCreateDlLayerLossCtc, create_dl_layer_loss_distanceCreateDlLayerLossDistance, create_dl_layer_loss_focalCreateDlLayerLossFocal, create_dl_layer_loss_huberCreateDlLayerLossHuber, create_dl_layer_lrnCreateDlLayerLrn, create_dl_layer_poolingCreateDlLayerPooling, create_dl_layer_reduceCreateDlLayerReduce, create_dl_layer_reshapeCreateDlLayerReshape, create_dl_layer_softmaxCreateDlLayerSoftmax, create_dl_layer_transposed_convolutionCreateDlLayerTransposedConvolution, create_dl_layer_zoom_factorCreateDlLayerZoomFactor, create_dl_layer_zoom_sizeCreateDlLayerZoomSize, create_dl_layer_zoom_to_layer_sizeCreateDlLayerZoomToLayerSize

モジュール🔗

Deep Learning Professional