Main Content

complexToRealLayer

Complex-to-real layer

Since R2024b

    Description

    A complex-to-real layer converts complex-valued data to real-valued data by splitting the data in a specified dimension.

    Creation

    Description

    layer = complexToRealLayer creates a complex-to-real layer. The layer interleaves the real and imaginary parts of the input in the channel dimension.

    example

    layer = complexToRealLayer(Name=Value) sets properties using one or more name-value arguments.

    Input Arguments

    expand all

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: complexToRealLayer(Name="complex-to-real") creates a complex-to-real layer, and sets the name to "complex-to-real".

    Data dimension to split and interleave, specified as one of these values:

    • "C" — Interleave the split data in the "C" (channel) dimension of the layer output.

    • "S" — Interleave the split data in the "S" (spatial) dimension of the layer output. If the input data has multiple spatial dimensions, then the layer interleaves the split data in the first spatial dimension.

    • "B" — Interleave the split data in the "B" (batch) dimension of the layer output.

    • "T" — Interleave the split data in the "T" (time) dimension of the layer output.

    • "U" — Interleave the split data in the "U" (unspecified) dimension of the layer output. If the input data has multiple "U" (unspecified) dimensions, then the layer interleaves the split data in the first "U" (unspecified) dimension.

    • "last" — Interleave the split data in the last dimension of the layer output.

    • Positive integer — interleave the split data in the specified dimension of the layer output.

    In the layer output, the dimension specified by OperationDimension is twice the size of the corresponding dimension in the layer input. That is, where X and Y represent the input and output data respectively, Y(2*n-1) = real(X(n)) and Y(2*n) = imag(X(n)).

    The input data must contain the specified dimension.

    The characters "S", "C", "T", "B", and "U" refer to the dimension labels of dlarray object formats. For more information, see Deep Learning Data Formats.

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

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

    Data Types: char | string

    Properties

    expand all

    Data dimension to split and interleave, specified as one of these values:

    • "C" — Interleave the split data in the "C" (channel) dimension of the layer output.

    • "S" — Interleave the split data in the "S" (spatial) dimension of the layer output. If the input data has multiple spatial dimensions, then the layer interleaves the split data in the first spatial dimension.

    • "B" — Interleave the split data in the "B" (batch) dimension of the layer output.

    • "T" — Interleave the split data in the "T" (time) dimension of the layer output.

    • "U" — Interleave the split data in the "U" (unspecified) dimension of the layer output. If the input data has multiple "U" (unspecified) dimensions, then the layer interleaves the split data in the first "U" (unspecified) dimension.

    • "last" — Interleave the split data in the last dimension of the layer output.

    • Positive integer — interleave the split data in the specified dimension of the layer output.

    In the layer output, the dimension specified by OperationDimension is twice the size of the corresponding dimension in the layer input. That is, where X and Y represent the input and output data respectively, Y(2*n-1) = real(X(n)) and Y(2*n) = imag(X(n)).

    The input data must contain the specified dimension.

    The characters "S", "C", "T", "B", and "U" refer to the dimension labels of dlarray object formats. For more information, see Deep Learning Data Formats.

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

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

    The ComplexToRealLayer object stores this property as a character vector.

    Data Types: char | string

    This property is read-only.

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

    Data Types: double

    This property is read-only.

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

    Data Types: cell

    This property is read-only.

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

    Data Types: double

    This property is read-only.

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

    Data Types: cell

    Examples

    collapse all

    Create a complex-to-real layer with the name "complex-to-real".

    layer = complexToRealLayer(Name="complex-to-real")
    layer = 
      ComplexToRealLayer with properties:
    
                      Name: 'complex-to-real'
    
       Hyperparameters
        OperationDimension: 'C'
    
    

    Include a complex-to-real layer in a layer array.

    layers = [
        featureInputLayer(3)
        complexToRealLayer
        fullyConnectedLayer(3)
        tanhLayer
        realToComplexLayer]
    layers = 
      5x1 Layer array with layers:
    
         1   ''   Feature Input     3 features
         2   ''   Complex-to-Real   Complex-to-real conversion along the "C" dimension.
         3   ''   Fully Connected   3 fully connected layer
         4   ''   Tanh              Hyperbolic tangent
         5   ''   Real-to-Complex   Real-to-complex conversion along the "C" dimension.
    

    Algorithms

    expand all

    Version History

    Introduced in R2024b