Main Content

realToComplexLayer

Real-to-complex layer

Since R2024b

    Description

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

    Creation

    Description

    layer = realToComplexLayer creates a real-to-complex layer. The layer merges interleaved data in the channel dimension.

    example

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

    example

    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: realToComplexLayer(Name="real-to-complex") creates a real-to-complex layer, and sets the name to "real-to-complex".

    Data dimension to merge, specified as one of these values:

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

    • "S" — Merge the data in the "S" (spatial) dimension of the layer output. If the input data has multiple spatial dimensions, then the layer merges the interleaved data in the first spatial dimension.

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

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

    • "U" — Merge the data in the "U" (unspecified) dimension of the layer output. If the input data has multiple "U" (unspecified) dimensions, then the layer merges the interleaved data in the first "U" (unspecified) dimension.

    • "last" — Merge the interleaved data in the last dimension of the layer output.

    • Positive integer — Merge the interleaved data in the specified dimension of the layer output.

    In the layer output, the dimension specified by OperationDimension is half the size of the corresponding dimension in the layer input. That is, for n=1,...,N/2, where N is the size of the specified dimension, and X and Y represent the input and output data, respectively, Y(n) = X(2*n-1)+1i*X(2*n).

    The input data must contain the specified dimension it must have size divisible by 2.

    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 merge, specified as one of these values:

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

    • "S" — Merge the data in the "S" (spatial) dimension of the layer output. If the input data has multiple spatial dimensions, then the layer merges the interleaved data in the first spatial dimension.

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

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

    • "U" — Merge the data in the "U" (unspecified) dimension of the layer output. If the input data has multiple "U" (unspecified) dimensions, then the layer merges the interleaved data in the first "U" (unspecified) dimension.

    • "last" — Merge the interleaved data in the last dimension of the layer output.

    • Positive integer — Merge the interleaved data in the specified dimension of the layer output.

    In the layer output, the dimension specified by OperationDimension is half the size of the corresponding dimension in the layer input. That is, for n=1,...,N/2, where N is the size of the specified dimension, and X and Y represent the input and output data, respectively, Y(n) = X(2*n-1)+1i*X(2*n).

    The input data must contain the specified dimension it must have size divisible by 2.

    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 RealToComplexLayer 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 real-to-complex layer with the name "real-to-complex".

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

    Include a real-to-complex 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