create_dl_layer_inputT_create_dl_layer_inputCreateDlLayerInputCreateDlLayerInputcreate_dl_layer_input (算子)

名称

create_dl_layer_inputT_create_dl_layer_inputCreateDlLayerInputCreateDlLayerInputcreate_dl_layer_input — 创建输入层。

签名

create_dl_layer_input( : : LayerName, Shape, GenParamName, GenParamValue : DLLayerInput)

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

void CreateDlLayerInput(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)

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)

static void HOperatorSet.CreateDlLayerInput(HTuple layerName, HTuple shape, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerInput)

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

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

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

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

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

描述

算子 create_dl_layer_inputcreate_dl_layer_inputCreateDlLayerInputCreateDlLayerInputCreateDlLayerInputcreate_dl_layer_input creates an input layer with spatial dimensions given by ShapeShapeShapeShapeshapeshape whose handle is returned in DLLayerInputDLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input

The parameter LayerNameLayerNameLayerNameLayerNamelayerNamelayer_name sets an individual layer name. Note that if creating a model using create_dl_modelcreate_dl_modelCreateDlModelCreateDlModelCreateDlModelcreate_dl_model each layer of the created network must have a unique name.

When the created model is applied using e.g., apply_dl_modelapply_dl_modelApplyDlModelApplyDlModelApplyDlModelapply_dl_model or train_dl_model_batchtrain_dl_model_batchTrainDlModelBatchTrainDlModelBatchTrainDlModelBatchtrain_dl_model_batch, it must be possible to map an input with its corresponding input layer. Operators applying a model expect a feeding dictionary DLSample, see 深度学习 / 模型. The mentioned mapping is done using dictionary entries, where the key matches the input layer name. Thus, for an input of this layer a sample dictionary will need an entry with the key LayerNameLayerNameLayerNameLayerNamelayerNamelayer_name (except if the 'input_type'"input_type""input_type""input_type""input_type""input_type" is set to 'constant'"constant""constant""constant""constant""constant", see below).

The parameter ShapeShapeShapeShapeshapeshape defines the shape of the input values (the values given in the feeding dictionary DLSample) and must be a tuple of length three, containing width, height, and depth of the input. The tuple values must be given as integer values and have have different meaning depending on the input type:

The batch size has to be set later with set_dl_model_paramset_dl_model_paramSetDlModelParamSetDlModelParamSetDlModelParamset_dl_model_param, once the model has been created by create_dl_modelcreate_dl_modelCreateDlModelCreateDlModelCreateDlModelcreate_dl_model

The following generic parameters GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name and the corresponding values GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value are supported:

'allow_smaller_tuple'"allow_smaller_tuple""allow_smaller_tuple""allow_smaller_tuple""allow_smaller_tuple""allow_smaller_tuple"

For tuple inputs, setting 'allow_smaller_tuple'"allow_smaller_tuple""allow_smaller_tuple""allow_smaller_tuple""allow_smaller_tuple""allow_smaller_tuple" to 'true'"true""true""true""true""true" allows to have an input tuple with less values than the total dimension given by ShapeShapeShapeShapeshapeshape. E.g., this can be the case if an input corresponds to the number of objects within one image and the number of objects changes from image to image. If fewer than the maximum number of values given by the total dimension of ShapeShapeShapeShapeshapeshape are present, the remaining values are set to zero.

ShapeShapeShapeShapeshapeshape should be set such that it fits the maximum expected length. For the example above this would be the maximum number of objects within one image present in the whole dataset.

Default: 'false'"false""false""false""false""false".

'const_val'"const_val""const_val""const_val""const_val""const_val"

Constant output value.

Restriction: Only an integer or float is settable. This value is only settable or gettable if 'input_type'"input_type""input_type""input_type""input_type""input_type" is set to 'constant'"constant""constant""constant""constant""constant".

Default: 0.0.

'input_type'"input_type""input_type""input_type""input_type""input_type"

Defines the type of input that is expected. The following values are possible:

'default'"default""default""default""default""default"

The layer expects a number of input images corresponding to the batch size.

'region_to_bin'"region_to_bin""region_to_bin""region_to_bin""region_to_bin""region_to_bin"

The layer expects a tuple of regions as input and internally converts it to a binary image where each region is encoded in one depth channel. Regions reaching out of the given dimensions are clipped to the width and height given by ShapeShapeShapeShapeshapeshape. The maximum number of regions is defined by the depth of ShapeShapeShapeShapeshapeshape. If fewer than the maximum number of regions are given, the output is filled up with empty (zero) images. For example, this can be the case if the regions are corresponding to objects within an image and the number of objects changes from image to image.

'constant'"constant""constant""constant""constant""constant"

The layer does not expect any key value pair in the input dictionary. Instead all entries within the output of this layer are filled with the value given by 'const_val'"const_val""const_val""const_val""const_val""const_val".

Default: 'default'"default""default""default""default""default".

'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output""is_inference_output"

Determines whether apply_dl_modelapply_dl_modelApplyDlModelApplyDlModelApplyDlModelapply_dl_model will include the output of this layer in the dictionary DLResultBatchDLResultBatchDLResultBatchDLResultBatchDLResultBatchdlresult_batch even without specifying this layer in OutputsOutputsOutputsOutputsoutputsoutputs ('true'"true""true""true""true""true") or not ('false'"false""false""false""false""false").

Default: 'false'"false""false""false""false""false"

Certain parameters of layers created using create_dl_layer_inputcreate_dl_layer_inputCreateDlLayerInputCreateDlLayerInputCreateDlLayerInputcreate_dl_layer_input can be set and retrieved using further operators. The following tables give an overview, which parameters can be set using set_dl_model_layer_paramset_dl_model_layer_paramSetDlModelLayerParamSetDlModelLayerParamSetDlModelLayerParamset_dl_model_layer_param and which ones can be retrieved using get_dl_model_layer_paramget_dl_model_layer_paramGetDlModelLayerParamGetDlModelLayerParamGetDlModelLayerParamget_dl_model_layer_param or get_dl_layer_paramget_dl_layer_paramGetDlLayerParamGetDlLayerParamGetDlLayerParamget_dl_layer_param。Note, the operators set_dl_model_layer_paramset_dl_model_layer_paramSetDlModelLayerParamSetDlModelLayerParamSetDlModelLayerParamset_dl_model_layer_param and get_dl_model_layer_paramget_dl_model_layer_paramGetDlModelLayerParamGetDlModelLayerParamGetDlModelLayerParamget_dl_model_layer_param require a model created by create_dl_modelcreate_dl_modelCreateDlModelCreateDlModelCreateDlModelcreate_dl_model

Layer Parameters set get
'input_layer'"input_layer""input_layer""input_layer""input_layer""input_layer"
'name'"name""name""name""name""name" (LayerNameLayerNameLayerNameLayerNamelayerNamelayer_name)
'output_layer'"output_layer""output_layer""output_layer""output_layer""output_layer" (DLLayerInputDLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input)
'shape'"shape""shape""shape""shape""shape" (ShapeShapeShapeShapeshapeshape)
'type'"type""type""type""type""type"
Generic Layer Parameters set get
'allow_smaller_tuple'"allow_smaller_tuple""allow_smaller_tuple""allow_smaller_tuple""allow_smaller_tuple""allow_smaller_tuple"
'const_val'"const_val""const_val""const_val""const_val""const_val"
'input_type'"input_type""input_type""input_type""input_type""input_type"
'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output""is_inference_output"
'num_trainable_params'"num_trainable_params""num_trainable_params""num_trainable_params""num_trainable_params""num_trainable_params"

执行信息

此算子返回一个句柄。请注意,即使该句柄被用作特定算子的输入参数,这些算子仍可能改变此句柄类型的实例状态。

参数

LayerNameLayerNameLayerNameLayerNamelayerNamelayer_name (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Name of the output layer.

ShapeShapeShapeShapeshapeshape (输入控制)  number-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Dimensions of the input (width, height, depth).

默认值: [224,224,3]

GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (输入控制)  attribute.name(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Generic input parameter names.

默认值: []

值列表: 'allow_smaller_tuple'"allow_smaller_tuple""allow_smaller_tuple""allow_smaller_tuple""allow_smaller_tuple""allow_smaller_tuple", 'const_val'"const_val""const_val""const_val""const_val""const_val", 'input_type'"input_type""input_type""input_type""input_type""input_type", 'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output""is_inference_output"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (输入控制)  attribute.value(-array) HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Generic input parameter values.

默认值: []

建议值: 0.0, 'constant'"constant""constant""constant""constant""constant", 'default'"default""default""default""default""default", 'false'"false""false""false""false""false", 'region_to_bin'"region_to_bin""region_to_bin""region_to_bin""region_to_bin""region_to_bin", 'true'"true""true""true""true""true"

DLLayerInputDLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input (输出控制)  dl_layer HDlLayer, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Input layer.

示例(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_activationcreate_dl_layer_activationCreateDlLayerActivationCreateDlLayerActivationCreateDlLayerActivationcreate_dl_layer_activation, create_dl_layer_batch_normalizationcreate_dl_layer_batch_normalizationCreateDlLayerBatchNormalizationCreateDlLayerBatchNormalizationCreateDlLayerBatchNormalizationcreate_dl_layer_batch_normalization, create_dl_layer_class_id_conversioncreate_dl_layer_class_id_conversionCreateDlLayerClassIdConversionCreateDlLayerClassIdConversionCreateDlLayerClassIdConversioncreate_dl_layer_class_id_conversion, create_dl_layer_class_id_conversioncreate_dl_layer_class_id_conversionCreateDlLayerClassIdConversionCreateDlLayerClassIdConversionCreateDlLayerClassIdConversioncreate_dl_layer_class_id_conversion, create_dl_layer_concatcreate_dl_layer_concatCreateDlLayerConcatCreateDlLayerConcatCreateDlLayerConcatcreate_dl_layer_concat, create_dl_layer_convolutioncreate_dl_layer_convolutionCreateDlLayerConvolutionCreateDlLayerConvolutionCreateDlLayerConvolutioncreate_dl_layer_convolution, create_dl_layer_densecreate_dl_layer_denseCreateDlLayerDenseCreateDlLayerDenseCreateDlLayerDensecreate_dl_layer_dense, create_dl_layer_depth_maxcreate_dl_layer_depth_maxCreateDlLayerDepthMaxCreateDlLayerDepthMaxCreateDlLayerDepthMaxcreate_dl_layer_depth_max, create_dl_layer_dropoutcreate_dl_layer_dropoutCreateDlLayerDropoutCreateDlLayerDropoutCreateDlLayerDropoutcreate_dl_layer_dropout, create_dl_layer_elementwisecreate_dl_layer_elementwiseCreateDlLayerElementwiseCreateDlLayerElementwiseCreateDlLayerElementwisecreate_dl_layer_elementwise, create_dl_layer_loss_cross_entropycreate_dl_layer_loss_cross_entropyCreateDlLayerLossCrossEntropyCreateDlLayerLossCrossEntropyCreateDlLayerLossCrossEntropycreate_dl_layer_loss_cross_entropy, create_dl_layer_loss_ctccreate_dl_layer_loss_ctcCreateDlLayerLossCtcCreateDlLayerLossCtcCreateDlLayerLossCtccreate_dl_layer_loss_ctc, create_dl_layer_loss_distancecreate_dl_layer_loss_distanceCreateDlLayerLossDistanceCreateDlLayerLossDistanceCreateDlLayerLossDistancecreate_dl_layer_loss_distance, create_dl_layer_loss_focalcreate_dl_layer_loss_focalCreateDlLayerLossFocalCreateDlLayerLossFocalCreateDlLayerLossFocalcreate_dl_layer_loss_focal, create_dl_layer_loss_hubercreate_dl_layer_loss_huberCreateDlLayerLossHuberCreateDlLayerLossHuberCreateDlLayerLossHubercreate_dl_layer_loss_huber, create_dl_layer_lrncreate_dl_layer_lrnCreateDlLayerLrnCreateDlLayerLrnCreateDlLayerLrncreate_dl_layer_lrn, create_dl_layer_poolingcreate_dl_layer_poolingCreateDlLayerPoolingCreateDlLayerPoolingCreateDlLayerPoolingcreate_dl_layer_pooling, create_dl_layer_reshapecreate_dl_layer_reshapeCreateDlLayerReshapeCreateDlLayerReshapeCreateDlLayerReshapecreate_dl_layer_reshape, create_dl_layer_softmaxcreate_dl_layer_softmaxCreateDlLayerSoftmaxCreateDlLayerSoftmaxCreateDlLayerSoftmaxcreate_dl_layer_softmax, create_dl_layer_transposed_convolutioncreate_dl_layer_transposed_convolutionCreateDlLayerTransposedConvolutionCreateDlLayerTransposedConvolutionCreateDlLayerTransposedConvolutioncreate_dl_layer_transposed_convolution, create_dl_layer_zoom_factorcreate_dl_layer_zoom_factorCreateDlLayerZoomFactorCreateDlLayerZoomFactorCreateDlLayerZoomFactorcreate_dl_layer_zoom_factor, create_dl_layer_zoom_sizecreate_dl_layer_zoom_sizeCreateDlLayerZoomSizeCreateDlLayerZoomSizeCreateDlLayerZoomSizecreate_dl_layer_zoom_size, create_dl_layer_zoom_to_layer_sizecreate_dl_layer_zoom_to_layer_sizeCreateDlLayerZoomToLayerSizeCreateDlLayerZoomToLayerSizeCreateDlLayerZoomToLayerSizecreate_dl_layer_zoom_to_layer_size

模块

深度学习训练