Skip to content

create_dl_layer_reshapeCreateDlLayerReshapeCreateDlLayerReshapecreate_dl_layer_reshapeT_create_dl_layer_reshapeπŸ”—

Short descriptionπŸ”—

create_dl_layer_reshapeCreateDlLayerReshapeCreateDlLayerReshapecreate_dl_layer_reshapeT_create_dl_layer_reshape β€” Create a reshape layer.

SignatureπŸ”—

create_dl_layer_reshape( dl_layer DLLayerInput, string LayerName, number Shape, attribute.name GenParamName, attribute.value GenParamValue, out dl_layer DLLayerReshape )void CreateDlLayerReshape( const HTuple& DLLayerInput, const HTuple& LayerName, const HTuple& Shape, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerReshape )static void HOperatorSet.CreateDlLayerReshape( HTuple DLLayerInput, HTuple layerName, HTuple shape, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerReshape )def create_dl_layer_reshape( dllayer_input: HHandle, 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_reshape( const Htuple DLLayerInput, const Htuple LayerName, const Htuple Shape, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerReshape )

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

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

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

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

HDlLayer HDlLayer.CreateDlLayerReshape( string layerName, HTuple shape, HTuple genParamName, HTuple genParamValue )

HDlLayer HDlLayer.CreateDlLayerReshape( string layerName, HTuple shape, string genParamName, string genParamValue )

DescriptionπŸ”—

The operator create_dl_layer_reshapeCreateDlLayerReshape creates a reshape layer whose handle is returned in DLLayerReshapeDLLayerReshapedllayer_reshape.

The parameter DLLayerInputDLLayerInputdllayer_input determines the feeding input layer and expects the layer handle as value.

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.

The parameter Shapeshapeshape determines the output shape, into which the input data is converted.

The value of Shapeshapeshape has to be given in the form [width, height, depth, batch_size], where the fourth value for the batch size is optional (see below). The overall size of the data has to remain constant, i.e., width_out * height_out * depth_out * batch_size_out = width_in * height_in * depth_in * batch_size_in.

The following options are available for setting the values of Shapeshapeshape:

  • Setting a value for each of the four dimensions,

  • One or several values are set to 00 in order to keep the value of the input dimension,

  • By setting a maximum of one value to -1-1, this value will be determined automatically. It will be calculated in a way that the overall size remains constant. Note that this is only possible if the computed value is an integer.

For a model that was created using create_dl_modelCreateDlModel the model’s batch size should always be settable with set_dl_model_paramSetDlModelParam. Hence, either the output batch size of the reshape layer equals the batch size of the model (batch size in Shapeshapeshape set to 00), or at least one reshape dimension should be calculated automatically (one value in Shapeshapeshape set to -1-1).

If the batch size is specified and it is not set to 00, at least one dimension of Shapeshapeshape must be set to -1-1. This is necessary, because for a model created with create_dl_modelCreateDlModel, the model’s batch size should always be settable with set_dl_model_paramSetDlModelParam. Hence, either the output batch size of the reshape layer equals the batch size of the model (batch size in Shapeshapeshape set to 00), or at least one reshape dimension should be calculated automatically (one value in Shapeshapeshape set to -1-1). In case the batch size is not specified it is set to 00, which leads to an output batch size equal to the input one.

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

  • '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 this operator create_dl_layer_reshapeCreateDlLayerReshape 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" (DLLayerInputDLLayerInputdllayer_input) x
'name'"name" (LayerNamelayerNamelayer_name) x x
'output_depth'"output_depth" (Shapeshapeshape) x
'output_height'"output_height" (Shapeshapeshape) x
'output_layer'"output_layer" (DLLayerReshapeDLLayerReshapedllayer_reshape) x
'output_width'"output_width" (Shapeshapeshape) x
'shape'"shape" x
'type'"type" x
Generic Layer Parameters set get
'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.

ParametersπŸ”—

DLLayerInputDLLayerInputdllayer_input (input_control) dl_layer β†’ (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)

Feeding layer.

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)

Shape of the output graph layer data.

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

Generic input parameter values.

Default: [][]
Suggested values: 'true', 'false'"true", "false"

DLLayerReshapeDLLayerReshapedllayer_reshape (output_control) dl_layer β†’ (handle)HTuple (HHandle)HDlLayer, HTuple (IntPtr)HHandleHtuple (handle)

Reshape layer.

ExampleπŸ”—

(HDevelop)

* Minimal example for reshape-layer.
create_dl_layer_input ('input', [64, 32, 10], [], [], DLLayerInput)
create_dl_layer_reshape (DLLayerInput, 'reshape_wh', [32, 64, 0], [], [], \
                         DLLayerReshapeWH)
create_dl_layer_reshape (DLLayerInput, 'reshape_bs', [64, 32, 1, -1], [], \
                         [], DLLayerReshapeBS)
* DLLayerReshapeBS has batch size 10 and depth 1.
get_dl_layer_param (DLLayerReshapeBS, 'shape', ShapeReshapeBS)
* Create a model and change the batch-size.
create_dl_model (DLLayerReshapeBS, DLModel)
set_dl_model_param (DLModel, 'batch_size', 2)
* DLLayerReshapeBS has batch size 20 now.
get_dl_model_layer_param (DLModel, 'reshape_bs', 'shape', ShapeReshapeBS)

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

create_dl_layer_inputCreateDlLayerInput, create_dl_layer_concatCreateDlLayerConcat

Possible successors

create_dl_layer_convolutionCreateDlLayerConvolution, create_dl_layer_denseCreateDlLayerDense

ModuleπŸ”—

Deep Learning Professional