Layers in a layer array or neural network 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 consists of one or more
of these characters:
"S" — Spatial
"C" — Channel
"B" — Batch
"T" — Time
"U" — Unspecified
For example, 2-D image data 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, can be described as having the
format "SSCB" (spatial, spatial, channel, batch).
You can interact with these dlarray objects in
automatic differentiation workflows, such as those for developing a
custom layer, using a functionLayer object, or using the forward and
predict
functions with dlnetwork objects.
This table shows the supported input formats of
AdditionLayer objects and the corresponding output
format. If the software passes the output of the layer to a custom layer
that does not inherit from the nnet.layer.Formattable
class, or a FunctionLayer object with the
Formattable property set to 0
(false), then the layer receives an unformatted
dlarray object with dimensions ordered according to the
formats in this table. The formats listed here are only a subset. The layer
may support additional formats such as formats with additional
"S" (spatial) or "U" (unspecified)
dimensions.
| Input Format | Output Format |
|---|
"CB" (channel, batch)
| "CB" (channel, batch)
|
"SCB" (spatial, channel,
batch)
| "SCB" (spatial, channel,
batch)
|
"SSCB" (spatial, spatial, channel,
batch)
| "SSCB" (spatial, spatial, channel,
batch)
|
"SSSCB" (spatial, spatial, spatial,
channel, batch)
| "SSSCB" (spatial, spatial, spatial,
channel, batch)
|
"CBT" (channel, batch,
time)
| "CBT" (channel, batch,
time)
|
"SCBT" (spatial, channel, batch,
time)
| "SCBT" (spatial, channel, batch,
time)
|
"SSCBT" (spatial, spatial, channel,
batch, time)
| "SSCBT" (spatial, spatial, channel,
batch, time)
|
"SSSCBT" (spatial, spatial, spatial,
channel, batch, time)
| "SSSCBT" (spatial, spatial, spatial,
channel, batch, time)
|
"CU" (channel,
unspecified)
| "CU" (channel,
unspecified)
|
"SC" (spatial,
channel)
| "SC" (spatial,
channel)
|
"SSC" (spatial, spatial,
channel)
| "SSC" (spatial, spatial,
channel)
|
"SSSC" (spatial, spatial, spatial,
channel)
| "SSSC" (spatial, spatial, spatial,
channel)
|
"BU" (batch,
unspecified)
| "BU" (batch,
unspecified)
|
If several input formats contain the same label, then the corresponding data for
each input must be a singleton or the same size as the nonsingleton data for the
other inputs. If an input format contains multiple U or S labels,
additionLayer matches each label to the labels in the other
input formats by their order of appearance.
In dlnetwork objects, AdditionLayer objects also
support these input and output format combinations.
| Input Format | Output Format |
|---|
"CT" (channel, time)
| "CT" (channel, time)
|
"SCT" (spatial, channel,
time)
| "SCT" (spatial, channel,
time)
|
"SSCT" (spatial, spatial, channel,
time)
| "SSCT" (spatial, spatial, channel,
time)
|
"SSSCT" (spatial, spatial, spatial,
channel, time)
| "SSSCT" (spatial, spatial, spatial,
channel, time)
|