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 number of elements of DimensionOrder must be greater than or equal to the number of dimensions in the layer input data.

    The layer reorders the input data so that dimension i of the layer output data matches dimension DimensionOrder(i) of the layer input data.

    Note

    For layers that output unformatted data, the software automatically removes trailing singleton dimensions after the second index. For formatted data, the software removes only trailing singleton dimensions labeled with "U" (unspecified).

    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. For Layer array input, the trainnet and dlnetwork functions automatically assign names to unnamed layers.

    Data Types: char

    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