RealToComplexLayer - Real-to-complex layer - MATLAB (original) (raw)
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
Syntax
Description
`layer` = realToComplexLayer
creates a real-to-complex layer. The layer merges interleaved data in the channel dimension.
`layer` = realToComplexLayer([Name=Value](#namevaluepairarguments))
sets properties using one or more name-value arguments.
Name-Value Arguments
Specify optional pairs of arguments asName1=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, forn=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 by2
.
The characters "S"
, "C"
, "T"
,"B"
, and "U"
refer to the dimension labels ofdlarray
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 a string scalar. For Layer
array input, the trainnet anddlnetwork functions automatically assign names to unnamed layers.
Data Types: char
| string
Properties
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, forn=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 by2
.
The characters "S"
, "C"
, "T"
,"B"
, and "U"
refer to the dimension labels ofdlarray
object formats. For more information, see Deep Learning Data Formats.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| char
| string
Data Types: char
| string
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
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(4) complexToRealLayer fullyConnectedLayer(4) tanhLayer realToComplexLayer]
layers = 5×1 Layer array with layers:
1 '' Feature Input 4 features
2 '' Complex-to-Real Complex-to-real conversion along the "C" dimension.
3 '' Fully Connected 4 fully connected layer
4 '' Tanh Hyperbolic tangent
5 '' Real-to-Complex Real-to-complex conversion along the "C" dimension.
Algorithms
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 format consists 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.
RealToComplexLayer
objects support complex-valued outputs.
Version History
Introduced in R2024b