Skip to content

create_dl_layer_inputCreateDlLayerInputCreateDlLayerInputcreate_dl_layer_inputT_create_dl_layer_input🔗

Short description🔗

create_dl_layer_inputCreateDlLayerInputCreateDlLayerInputcreate_dl_layer_inputT_create_dl_layer_input — Create an input layer.

Signature🔗

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 )

Description🔗

The operator create_dl_layer_inputCreateDlLayerInput creates an input layer with spatial dimensions given by Shapeshapeshape whose handle is returned in DLLayerInputDLLayerInputdllayer_input.

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

When the created model is applied using e.g., apply_dl_modelApplyDlModel or train_dl_model_batchTrainDlModelBatch, it must be possible to map an input with its corresponding input layer. Operators applying a model expect a feeding dictionary DLSample, see Deep Learning / Model. 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 LayerNamelayerNamelayer_name (except if the 'input_type'"input_type" is set to 'constant'"constant", see below).

The parameter Shapeshapeshape 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:

  • for an input image the layer Shapeshapeshape defines the image size. Images shall be given with type real (for information on image types see Image).

  • for an input tuple its length will need to match the product of the individual values in Shapeshapeshape, i.e., width \(\times\) height \(\times\) depth.

    Tuple values are distributed along the column- (width), row- (height), and depth-axes in this order. Input tuple values can be given either as integer or real.

The batch size has to be set later with set_dl_model_paramSetDlModelParam, once the model has been created by create_dl_modelCreateDlModel.

The following generic parameters GenParamNamegenParamNamegen_param_name and the corresponding values GenParamValuegenParamValuegen_param_value are supported:

  • 'allow_smaller_tuple'"allow_smaller_tuple": For tuple inputs, setting 'allow_smaller_tuple'"allow_smaller_tuple" to 'true'"true" allows to have an input tuple with less values than the total dimension given by Shapeshapeshape. 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 Shapeshapeshape are present, the remaining values are set to zero.

    Shapeshapeshape 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".

  • '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" is set to 'constant'"constant".

    Default: 0.00.0.

  • 'input_type'"input_type": Defines the type of input that is expected. The following values are possible:

    • 'default'"default": The layer expects a number of input images corresponding to the batch size.

    • '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 Shapeshapeshape. The maximum number of regions is defined by the depth of Shapeshapeshape. 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": 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".

    Default: 'default'"default".

  • 'keep_batch_size_const'"keep_batch_size_const": For constant inputs, this parameter can be set to 'true'"true", if the input should always keep its batch size constant, independent from changing the model batch size.

    Default: 'false'"false".

  • 'is_inference_output'"is_inference_output": Determines whether apply_dl_modelApplyDlModel will include the output of this layer in the dictionary DLResultBatchDLResultBatchdlresult_batch even without specifying this layer in Outputsoutputsoutputs ('true'"true") or not ('false'"false").

    Default: 'false'"false"

Certain parameters of layers created using create_dl_layer_inputCreateDlLayerInput can be set and retrieved using further operators. The following tables give an overview, which parameters can be set using set_dl_model_layer_paramSetDlModelLayerParam and which ones can be retrieved using get_dl_model_layer_paramGetDlModelLayerParam or get_dl_layer_paramGetDlLayerParam. Note, the operators set_dl_model_layer_paramSetDlModelLayerParam and get_dl_model_layer_paramGetDlModelLayerParam require a model created by create_dl_modelCreateDlModel.

Layer Parameters 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
Generic Layer Parameters 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

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters🔗

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

Name of the output layer.

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

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

Default: [224, 224, 3][224, 224, 3]

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

Generic input parameter names.

Default: [][]
List of values: '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)

Generic input parameter values.

Default: [][]
Suggested values: 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)

Input layer.

Example🔗

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

Combinations with other operators🔗

Combinations

Possible successors

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

Module🔗

Deep Learning Professional