Skip to content

create_dl_layer_permutationCreateDlLayerPermutationCreateDlLayerPermutationcreate_dl_layer_permutationT_create_dl_layer_permutation🔗

Short description🔗

create_dl_layer_permutationCreateDlLayerPermutationCreateDlLayerPermutationcreate_dl_layer_permutationT_create_dl_layer_permutation — Create a permutation layer.

Signature🔗

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

Herror T_create_dl_layer_permutation( const Htuple DLLayerInput, const Htuple LayerName, const Htuple Permutation, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerPermutation )

HDlLayer HDlLayer::CreateDlLayerPermutation( const HString& LayerName, const HTuple& Permutation, const HTuple& GenParamName, const HTuple& GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerPermutation( const HString& LayerName, const HTuple& Permutation, const HString& GenParamName, const HString& GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerPermutation( const char* LayerName, const HTuple& Permutation, const char* GenParamName, const char* GenParamValue ) const

HDlLayer HDlLayer::CreateDlLayerPermutation( const wchar_t* LayerName, const HTuple& Permutation, const wchar_t* GenParamName, const wchar_t* GenParamValue ) const (Windows only)

HDlLayer HDlLayer.CreateDlLayerPermutation( string layerName, HTuple permutation, HTuple genParamName, HTuple genParamValue )

HDlLayer HDlLayer.CreateDlLayerPermutation( string layerName, HTuple permutation, string genParamName, string genParamValue )

Description🔗

The operator create_dl_layer_permutationCreateDlLayerPermutation creates a permutation layer whose handle is returned in DLLayerPermutationDLLayerPermutationdllayer_permutation.

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 Permutationpermutationpermutation specifies the order in which the axes of DLLayerInputDLLayerInputdllayer_input appear after permutation.

Permutationpermutationpermutation accepts a list of strings or integers that lists the axes in the desired output order. For example, ['width', 'height', 'batch', 'depth']["width", "height", "batch", "depth"] leads to swapping the depth and the batch axes. Each axis must be unique and be taken from the set \({[0, 1, 2, 3]}\) or \({['width', 'height', 'depth', 'batch']}\).

Using a CPU device, for some values of Permutationpermutationpermutation the internal code can not be optimized which can lead to an increased runtime. In this case, the layer parameter 'fall_back_to_baseline'"fall_back_to_baseline" is set to 'true'"true".

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

  • 'axes_format'"axes_format": Compatibility parameter that determines whether the specified Permutationpermutationpermutation is given in WHCN format (default) or in NCHW format. The parameter changes how the specified axes are interpreted. For example, with permutation [0, 1, 3, 2][0, 1, 3, 2] and 'axes_format'"axes_format" 'nchw'"nchw", the height and width dimensions will be swapped. If 'axes_format'"axes_format" is set to 'whcn'"whcn" or left unspecified, the required permutation to get the same effect is [1, 0, 2, 3][1, 0, 2, 3]. Instead of indices, strings can also be used to specify the permutation.

    List of values: 'nchw'"nchw", 'whcn'"whcn"

    Default: 'whcn'"whcn"

  • '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_permutationCreateDlLayerPermutation 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
'fall_back_to_baseline'"fall_back_to_baseline" x
'input_layer'"input_layer" (DLLayerInputDLLayerInputdllayer_input) x
'name'"name" (LayerNamelayerNamelayer_name) x x
'permutation'"permutation" (Permutationpermutationpermutation) 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.

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

Order of the permuted axes.

Default: ['batch', 'depth', 'height', 'width']["batch", "depth", "height", "width"]

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: 'axes_format', 'is_inference_output'"axes_format", "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', 'nchw', 'whcn'"true", "false", "nchw", "whcn"

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

Permutation layer.

Example🔗

(HDevelop)

* Swap the batch and depth axes with a permutation layer.
create_dl_layer_input ('input_a', [1, 1, 4], ['input_type', 'const_val'], \
                       ['constant', 1.0], DLLayerInputA)
create_dl_layer_input ('input_b', [1, 1, 4], ['input_type', 'const_val'], \
                       ['constant', 2.0], DLLayerInputB)
create_dl_layer_concat ([DLLayerInputA, DLLayerInputB], 'concat', 'batch', \
                        [], [], DLLayerConcat)
create_dl_layer_permutation (DLLayerConcat, 'permute', ['width','height','batch','depth'], \
                             [], [], DLLayerPermute)
create_dl_layer_depth_max (DLLayerPermute, 'depth_max', 'value', \
                           [], [], _, DLLayerDepthMaxValue)
create_dl_model (DLLayerDepthMaxValue, DLModel)
* The expected output values in DLResultBatch.depth_max are [2.0,2.0,2.0,2.0]
query_available_dl_devices (['runtime'], ['cpu'], DLDeviceHandles)
set_dl_model_param (DLModel, 'device', DLDeviceHandles[0])
apply_dl_model (DLModel, dict{}, [], DLResultBatch)

Combinations with other operators🔗

Combinations

Possible predecessors

create_dl_layer_inputCreateDlLayerInput, create_dl_layer_concatCreateDlLayerConcat, create_dl_layer_reshapeCreateDlLayerReshape

Possible successors

create_dl_layer_convolutionCreateDlLayerConvolution, create_dl_layer_denseCreateDlLayerDense, create_dl_layer_reshapeCreateDlLayerReshape

See also

create_dl_layer_reshapeCreateDlLayerReshape

Module🔗

Deep Learning Professional