Main Content

permuteLayer

Permute layer

Since R2025a

    Description

    A permute layer reorders the dimensions of data.

    Creation

    Description

    layer = permuteLayer(dimorder) creates a permute layer and sets the DimensionOrder property.

    example

    layer = permuteLayer(dimorder,Name=name) also sets the optional Name property using a name-value argument.

    Properties

    expand all

    Permute

    This property is read-only after creation.

    Dimension order, specified as a row vector of positive integers.

    The layer reorders the input data so that dimension i of the layer output data matches dimension DimensionOrder(i) of the layer input data. If the layer input data has more dimensions than specified by DimensionOrder, then the layer leaves the additional dimensions unchanged.

    The PermuteLayer stores this property as a double.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Layer

    Layer name, specified as a character vector or a string scalar. For Layer array input, the trainnet and dlnetwork functions automatically assign names to unnamed layers.

    The PermuteLayer object stores this property as a character vector.

    Data Types: char | string

    This property is read-only.

    Number of inputs to the layer, stored as 1. This layer accepts a single input only.

    Data Types: double

    This property is read-only.

    Input names, stored as {'in'}. This layer accepts a single input only.

    Data Types: cell

    This property is read-only.

    Number of outputs from the layer, stored as 1. This layer has a single output only.

    Data Types: double

    This property is read-only.

    Output names, stored as {'out'}. This layer has a single output only.

    Data Types: cell

    Examples

    collapse all

    Create a permute layer that switches the first and third dimensions of 4-D data.

    layer = permuteLayer([3 2 1 4])
    layer = 
      PermuteLayer with properties:
    
                  Name: ''
    
       Hyperparameters
        DimensionOrder: [3 2 1 4]
    
    

    Algorithms

    expand all

    Extended Capabilities

    expand all

    Version History

    Introduced in R2025a