realToComplexLayer
Description
A real-to-complex layer converts real-valued data to complex-valued data by merging the data in a specified dimension.
Creation
Description
creates a
real-to-complex layer. The layer merges interleaved data in the channel dimension.layer
= realToComplexLayer
sets properties using one or more name-value arguments.layer
= realToComplexLayer(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: realToComplexLayer(Name="real-to-complex")
creates a
real-to-complex layer, and sets the name to
"real-to-complex"
.
OperationDimension
— Data dimension to merge
"C"
(default) | "S"
| "B"
| "T"
| "U"
| "last"
| positive integer | "last"
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
Properties
OperationDimension
— Operation dimension
"C"
(default) | "S"
| "B"
| "T"
| "U"
| "last"
| positive integer
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
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 Real-to-Complex Layer
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
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).
RealToComplexLayer
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
RealToComplexLayer
objects support complex-valued outputs.
Version History
Introduced in R2024b
See Also
complexToRealLayer
| 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 (한국어)