complexToRealLayer
Description
A complex-to-real layer converts complex-valued data to real-valued data by splitting the data in a specified dimension.
Creation
Description
creates a
complex-to-real layer. The layer interleaves the real and imaginary parts of the input in
the channel dimension.layer
= complexToRealLayer
sets properties using one or more name-value arguments.layer
= complexToRealLayer(Name=Value
)
Input 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"
.
OperationDimension
— Data dimension to split and interleave
"C"
(default) | "S"
| "B"
| "T"
| "U"
| positive integer | "last"
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
Properties
OperationDimension
— Operation dimension
"C"
(default) | "S"
| "B"
| "T"
| "U"
| positive integer
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
Name
— Layer name
""
(default) | character vector | string scalar
NumInputs
— Number of inputs
1
(default)
This property is read-only.
Number of inputs to the layer, returned as 1
. This layer accepts a
single input only.
Data Types: double
InputNames
— Input names
{'in'}
(default)
This property is read-only.
Input names, returned as {'in'}
. This layer accepts a single input
only.
Data Types: cell
NumOutputs
— Number of outputs
1
(default)
This property is read-only.
Number of outputs from the layer, returned as 1
. This layer has a
single output only.
Data Types: double
OutputNames
— Output names
{'out'}
(default)
This property is read-only.
Output names, returned as {'out'}
. This layer has a single output
only.
Data Types: cell
Examples
Create Complex-to-Real Layer
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
Layer Input and Output Formats
Layers in a layer array or layer graph pass data to subsequent layers as formatted dlarray
objects.
The format of a dlarray
object is a string of characters in which each
character describes the corresponding dimension of the data. The formats consist of one or
more of these characters:
"S"
— Spatial"C"
— Channel"B"
— Batch"T"
— Time"U"
— Unspecified
For example, you can describe 2-D image data that is represented as a 4-D array, where the
first two dimensions correspond to the spatial dimensions of the images, the third
dimension corresponds to the channels of the images, and the fourth dimension
corresponds to the batch dimension, as having the format "SSCB"
(spatial, spatial, channel, batch).
ComplexToRealLayer
objects support input data of any format. The layer does not add
or remove any dimensions, so it outputs data with the same format as its inputs.
Complex Numbers
ComplexToRealLayer
objects support complex-valued inputs.
Version History
Introduced in R2024b
See Also
realToComplexLayer
| trainnet
| trainingOptions
| dlnetwork
| minibatchpredict
| predict
| scores2label
| imageInputLayer
| image3dInputLayer
| sequenceInputLayer
| featureInputLayer
| inputLayer
Topics
- Train Network with Complex-Valued Data
- Sequence Classification Using 1-D Convolutions
- Sequence Classification Using Deep Learning
- Sequence-to-Sequence Classification Using Deep Learning
- Sequence-to-Sequence Regression Using Deep Learning
- Sequence-to-One Regression Using Deep Learning
- List of Deep Learning Layers
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)