create_dl_layer_reshapeT_create_dl_layer_reshapeCreateDlLayerReshapeCreateDlLayerReshapecreate_dl_layer_reshape (Operator)

Name

create_dl_layer_reshapeT_create_dl_layer_reshapeCreateDlLayerReshapeCreateDlLayerReshapecreate_dl_layer_reshape — Create a reshape layer.

Signature

create_dl_layer_reshape( : : DLLayerInput, LayerName, Shape, GenParamName, GenParamValue : DLLayerReshape)

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

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

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

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

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

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

Description

The operator create_dl_layer_reshapecreate_dl_layer_reshapeCreateDlLayerReshapeCreateDlLayerReshapecreate_dl_layer_reshape creates a reshape layer whose handle is returned in DLLayerReshapeDLLayerReshapeDLLayerReshapeDLLayerReshapedllayer_reshape.

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

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

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

The value of ShapeShapeShapeshapeshape 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 ShapeShapeShapeshapeshape:

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

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

The following generic parameters GenParamNameGenParamNameGenParamNamegenParamNamegen_param_name and the corresponding values GenParamValueGenParamValueGenParamValuegenParamValuegen_param_value are supported:

'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output":

Determines whether apply_dl_modelapply_dl_modelApplyDlModelApplyDlModelapply_dl_model will include the output of this layer in the dictionary DLResultBatchDLResultBatchDLResultBatchDLResultBatchdlresult_batch even without specifying this layer in OutputsOutputsOutputsoutputsoutputs ('true'"true""true""true""true") or not ('false'"false""false""false""false").

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

Certain parameters of layers created using this operator create_dl_layer_reshapecreate_dl_layer_reshapeCreateDlLayerReshapeCreateDlLayerReshapecreate_dl_layer_reshape 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_paramSetDlModelLayerParamSetDlModelLayerParamset_dl_model_layer_param and which ones can be retrieved using get_dl_model_layer_paramget_dl_model_layer_paramGetDlModelLayerParamGetDlModelLayerParamget_dl_model_layer_param or get_dl_layer_paramget_dl_layer_paramGetDlLayerParamGetDlLayerParamget_dl_layer_param. Note, the operators set_dl_model_layer_paramset_dl_model_layer_paramSetDlModelLayerParamSetDlModelLayerParamset_dl_model_layer_param and get_dl_model_layer_paramget_dl_model_layer_paramGetDlModelLayerParamGetDlModelLayerParamget_dl_model_layer_param require a model created by create_dl_modelcreate_dl_modelCreateDlModelCreateDlModelcreate_dl_model.

Layer Parameters set get
'input_layer'"input_layer""input_layer""input_layer""input_layer" (DLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input) x
'name'"name""name""name""name" (LayerNameLayerNameLayerNamelayerNamelayer_name) x x
'output_depth'"output_depth""output_depth""output_depth""output_depth" (ShapeShapeShapeshapeshape) x
'output_height'"output_height""output_height""output_height""output_height" (ShapeShapeShapeshapeshape) x
'output_layer'"output_layer""output_layer""output_layer""output_layer" (ShapeShapeShapeshapeshape) x
'output_width'"output_width""output_width""output_width""output_width" (ShapeShapeShapeshapeshape) x
'shape'"shape""shape""shape""shape" x
'type'"type""type""type""type" x
Generic Layer Parameters set get
'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output" x x
'num_trainable_params'"num_trainable_params""num_trainable_params""num_trainable_params""num_trainable_params" x

Execution Information

Parameters

DLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input (input_control)  dl_layer HDlLayer, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Feeding layer.

LayerNameLayerNameLayerNamelayerNamelayer_name (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Name of the output layer.

ShapeShapeShapeshapeshape (input_control)  number-array HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Shape of the output graph layer data.

Default: [224,224,3]

GenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (input_control)  attribute.name(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Generic input parameter names.

Default: []

List of values: 'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output"

GenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (input_control)  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.

Default: []

Suggested values: 'true'"true""true""true""true", 'false'"false""false""false""false"

DLLayerReshapeDLLayerReshapeDLLayerReshapeDLLayerReshapedllayer_reshape (output_control)  dl_layer HDlLayer, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (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)

Possible Predecessors

create_dl_layer_inputcreate_dl_layer_inputCreateDlLayerInputCreateDlLayerInputcreate_dl_layer_input, create_dl_layer_concatcreate_dl_layer_concatCreateDlLayerConcatCreateDlLayerConcatcreate_dl_layer_concat

Possible Successors

create_dl_layer_convolutioncreate_dl_layer_convolutionCreateDlLayerConvolutionCreateDlLayerConvolutioncreate_dl_layer_convolution, create_dl_layer_densecreate_dl_layer_denseCreateDlLayerDenseCreateDlLayerDensecreate_dl_layer_dense

Module

Deep Learning Professional