List of Functions with dlarray
Support
Deep Learning Toolbox Functions with dlarray
Support
These tables list and briefly describe the Deep Learning Toolbox™ functions that operate on dlarray
objects.
Deep Learning Operations
Function  Description 

attention  The attention operation focuses on parts of the input using weighted multiplication operations. 
avgpool  The average pooling operation performs downsampling by dividing the input into pooling regions and computing the average value of each region. 
batchnorm  The batch normalization operation normalizes the input data
across all observations for each channel independently. To speed up training of the
convolutional neural network and reduce the sensitivity to network initialization, use batch
normalization between convolution and nonlinear operations such as relu . 
crossentropy  The crossentropy operation computes the crossentropy loss between network predictions and binary or onehot encoded targets for singlelabel and multilabel classification tasks. 
indexcrossentropy (since R2024b)  The index crossentropy operation computes the crossentropy loss between network predictions and targets specified as integer class indices for singlelabel classification tasks. 
crosschannelnorm  The crosschannel normalization operation uses local responses
in different channels to normalize each activation. Crosschannel normalization typically
follows a relu operation.
Crosschannel normalization is also known as local response normalization. 
ctc  The CTC operation computes the connectionist temporal classification (CTC) loss between unaligned sequences. 
dlconv  The convolution operation applies sliding filters to the input
data. Use the dlconv function for deep learning convolution, grouped
convolution, and channelwise separable convolution. 
dlode45  The neural ordinary differential equation (ODE) operation returns the solution of a specified ODE. 
dltranspconv  The transposed convolution operation upsamples feature maps. 
embed  The embed operation converts numeric indices to numeric vectors, where the indices correspond to discrete data. Use embeddings to map discrete data such as categorical values or words to numeric vectors. 
fullyconnect  The fully connect operation multiplies the input by a weight matrix and then adds a bias vector. 
gelu  The Gaussian error linear unit (GELU) activation operation weights the input by its probability under a Gaussian distribution. 
groupnorm  The group normalization operation normalizes the input data
across grouped subsets of channels for each observation independently. To speed up training of
the convolutional neural network and reduce the sensitivity to network initialization, use group
normalization between convolution and nonlinear operations such as relu . 
gru  The gated recurrent unit (GRU) operation allows a network to learn dependencies between time steps in time series and sequence data. 
huber  The Huber operation computes the Huber loss between network predictions and target values for regression tasks. When the 'TransitionPoint' option is 1, this is also known as smooth L_{1} loss. 
instancenorm  The instance normalization operation normalizes the input data
across each channel for each observation independently. To improve the convergence of training
the convolutional neural network and reduce the sensitivity to network hyperparameters, use
instance normalization between convolution and nonlinear operations such as relu . 
l1loss  The L_{1} loss operation computes the
L_{1} loss given network predictions and target values. When the
Reduction option is "sum" and the
NormalizationFactor option is "batchsize" , the
computed value is known as the mean absolute error (MAE). 
l2loss  The L_{2} loss operation computes the
L_{2} loss (based on the squared L_{2} norm) given
network predictions and target values. When the Reduction option is
"sum" and the NormalizationFactor option is
"batchsize" , the computed value is known as the mean squared error
(MSE). 
layernorm  The layer normalization operation normalizes the input data across all channels for each observation independently. To speed up training of recurrent and multilayer perceptron neural networks and reduce the sensitivity to network initialization, use layer normalization after the learnable operations, such as LSTM and fully connect operations. 
leakyrelu  The leaky rectified linear unit (ReLU) activation operation performs a nonlinear threshold operation, where any input value less than zero is multiplied by a fixed scale factor. 
lstm  The long shortterm memory (LSTM) operation allows a network to learn longterm dependencies between time steps in time series and sequence data. 
maxpool  The maximum pooling operation performs downsampling by dividing the input into pooling regions and computing the maximum value of each region. 
maxunpool  The maximum unpooling operation unpools the output of a maximum pooling operation by upsampling and padding with zeros. 
mse  The half mean squared error operation computes the half mean squared error loss between network predictions and target values for regression tasks. 
onehotdecode  The onehot decode operation decodes probability vectors, such as the output of a classification network, into classification labels. The input 
relu  The rectified linear unit (ReLU) activation operation performs a nonlinear threshold operation, where any input value less than zero is set to zero. 
sigmoid  The sigmoid activation operation applies the sigmoid function to the input data. 
softmax  The softmax activation operation applies the softmax function to the channel dimension of the input data. 
dlarray
Specific Functions
Function  Description 

dims  The dims function returns the data format of the input. 
dlfeval  The dlfeval function evaluates deep learning models and functions with automatic differentiation enabled. 
dlgradient  The dlgradient function computes derivatives using automatic differentiation. 
dljacobian  The Jacobian deep learning operation returns the Jacobian matrix for neural network and model function outputs with respect to the specified input data and operation dimension. 
dldivergence  The divergence deep learning operation returns the mathematical divergence of neural network and model function outputs with respect to the specified input data and operation dimension. 
dllaplacian  The Laplacian deep learning operation returns the Laplacian of neural network and model function outputs with respect to the specified input data and operation dimension. 
extractdata  The extractdata function extracts the data from a dlarray object. 
finddim  The finddim function finds the dimension index of a formatted dlarray object for a specified label. 
stripdims  The stripdims function removes the format from a dlarray object. 
DomainSpecific Functions with dlarray
Support
These tables list and briefly describe the domainspecific functions that operate on
dlarray
objects.
Computer Vision
Function  Description 

focalCrossEntropy (Computer Vision Toolbox)  Calculate the focal crossentropy loss between two
dlarray objects that represent predicted and target
classification labels. 
generalizedDice (Computer Vision Toolbox)  Measure the similarity between two dlarray objects
that represent segmented images, using a generalized Dice metric that
accounts for class weighting. 
roialign (Computer Vision Toolbox)  Perform ROI pooling of dlarray data. 
Image Processing
Function  Description 

depthToSpace (Image Processing Toolbox)  Rearrange dlarray data from the depth dimension into
spatial blocks. 
dlresize (Image Processing Toolbox)  Resize the spatial dimensions of a dlarray . 
imageshow (Image Processing Toolbox)  Display a single 2D image stored in a dlarray .
Unformatted dlarray objects must contain a grayscale or
RGB image with optional singleton dimensions corresponding to time or
batch. Formatted dlarray objects must have one of these
formats, where time and batch are singleton dimensions:
"SS" , "SSC" ,
"SSB" , "SSCB" ,
"SST" , "SSCT" ,
"SSBT" , "SSCBT" . 
montage (Image Processing Toolbox)  Display a montage consisting of several
2D frames of a multiframe image stored in a
dlarray (since R2024b). 
multissim (Image Processing Toolbox)  Measure the similarity between two dlarray objects
that represent 2D images, using the multiscale structural similarity
(MSSSIM) metric. 
multissim3 (Image Processing Toolbox)  Measure the similarity between two dlarray objects
that represent 3D images, using the 3D MSSSIM metric. 
psnr (Image Processing Toolbox)  Measure the similarity between two dlarray objects
that represent images using the peak signaltonoise ratio (PSNR)
metric. 
spaceToDepth (Image Processing Toolbox)  Rearrange spatial blocks of dlarray data into the
depth dimension. 
ssim (Image Processing Toolbox)  Measure the similarity between two dlarray objects
that represent images using the structural similarity (SSIM)
metric. 
Signal Processing
Function  Description 

dlcwt (Wavelet Toolbox)  Compute continuous wavelet transform. 
dlicwt (Wavelet Toolbox)  Compute inverse continuous wavelet transform. 
dlmodwt (Wavelet Toolbox)  Compute maximal overlap discrete wavelet transform and multiresolution analysis. 
dlstft (Signal Processing Toolbox)  Compute shorttime Fourier transform. 
dlistft (Signal Processing Toolbox)  Compute inverse shorttime Fourier transform. 
framesig (Signal Processing Toolbox)  Partition signal into frames. 
scatteringFeatures (Wavelet Toolbox)  Compute wavelet joint timefrequency scattering feature tensor. 
scatteringTransform (Wavelet Toolbox)  Compute wavelet joint timefrequency scattering transform. 
Wireless Communications
Function  Description 

awgn (Communications Toolbox)  Filter a signal represented in a dlarray object
through an additive white Gaussian noise (AWGN) channel. Only
unformatted input arrays are supported. 
comm.ChannelFilter (Communications Toolbox)  Filter a signal represented in a dlarray object
through a channel using multipath gains at specified path delays. Only
unformatted input arrays are supported. 
comm.MIMOChannel (Communications Toolbox)  Filter a signal represented in a dlarray object
through an MIMO channel. Only unformatted input arrays are
supported. 
bit2int (Communications Toolbox)  Convert input bits represented in a dlarray object
to integers. Only unformatted input arrays are supported. 
genqammod (Communications Toolbox)  Modulate a signal represented in a dlarray object
using general quadrature amplitude modulation (QAM). Only unformatted
input arrays are supported. 
ofdmmod (Communications Toolbox)  Modulate a frequencydomain signal represented in a
dlarray object using orthogonal frequency division
multiplexing (OFDM). Only unformatted input arrays are
supported. 
ofdmdemod (Communications Toolbox)  Demodulate a timedomain signal represented in a
dlarray object using orthogonal frequency division
multiplexing (OFDM). Only unformatted input arrays are
supported. 
ofdmChannelResponse (Communications Toolbox)  Calculate the frequency response of a timevarying channel
represented in a dlarray object. Only unformatted input
arrays are supported. 
ofdmEqualize (Communications Toolbox)  Equalize a frequencydomain OFDM signal represented in a
dlarray object. Only unformatted input arrays are
supported. 
MATLAB Functions with dlarray
Support
Many MATLAB^{®} functions operate on dlarray
objects. These tables list the
usage notes and limitations for these functions when you use dlarray
arguments.
Unary Elementwise Functions
Function  Notes and Limitations 

abs  The output 
acos  
acosh  
acot  
acsc  
angle  
asec  
asin  
asinh  
atan  
atan2  
atanh  
conj  
cos  
cosh  
cot  
csc  
erf  
exp  
imag  
log  
real  
reallog  
realsqrt  
sec  
sign  
sin  
sinh  
sqrt  
tan  
tanh  
uminus ,
  
uplus ,
+  
log10 (since R2024b)  The output 
Binary Elementwise Operators
Function  Notes and Limitations 

complex  For the oneinput syntax, the output For the twoinput syntax, if

minus ,
  If the two 
plus ,
+  
power ,
.^  
rdivide ,
./  
realpow  
times ,
.* 
Reduction Functions
Function  Notes and Limitations 

mean 

normalize 

std 

prod 

sum  
vecnorm  The output 
median (since R2024b) 

Extrema Functions
Function  Notes and Limitations 

ceil  The output 
eps 

fix  The output 
floor  The output 
max 

min  
rescale 

round 

Fourier Transforms
Function  Notes and Limitations 

fft
 Only unformatted input arrays are supported. 
ifft 

Other Math Operations
Function  Notes and Limitations 

colon ,
: 

interp1 

mrdivide ,
/  The second 
mtimes ,
* 

ode45  The supported syntaxes are:
At least one of If
For For Tip For neural ODE workflows, use 
pagemtimes  One input can be a formatted 
pinv (since R2024a)  The first argument must be a 2D unformatted

Logical Operations
Function  Notes and Limitations 

all 
The output 
and ,
&  If the two 
any 
The output 
eq ,
==  If the two 
ge ,
>=  
gt ,
>  
le ,
<=  
lt ,
<  
ne ,
~=  
not ,
~ 
The output 
or ,
  If the two 
xor 
Size Manipulation Functions
Function  Notes and Limitations 

reshape  The output 
squeeze  Twodimensional 
Sorting and Transposition Operations
Function  Notes and Limitations 

sort (since R2024a)  N/A 
ctranspose ,
'  If the input 
permute  If the input 
transpose ,
.'  If the input 
Concatenation Functions
Conversion Functions
Function  Notes and Limitations 

cast 

double  The output is a 
gather (Parallel Computing Toolbox) 

gpuArray (Parallel Computing Toolbox) 

logical  The output is a dlarray that contains data of type
logical . 
single  The output is a dlarray that contains data of type
single . 
Comparison Functions
Function  Notes and Limitations 

isequal 

isequaln 

Data Type and Value Identification Functions
Function  Notes and Limitations 

isdlarray
 N/A 
isfinite  The software
applies the function to the underlying data of an input

isfloat  
isgpuarray (Parallel Computing Toolbox)  
isinf  
islogical  
isnan  
isnumeric  
isreal  
isUnderlyingType  N/A 
mustBeUnderlyingType  
underlyingType  
validateattributes  If input array A is a formatted
dlarray , its dimensions are permuted to match the
order "SCBTU" . Size validation is applied after
permutation. 
Size Identification Functions
Function  Notes and Limitations 

iscolumn  This function returns true for a
dlarray that is a column vector, where each
dimension except the first is a singleton. For example, a 3by1by1
dlarray is a column vector. 
ismatrix  This function returns true for
dlarray objects with only two dimensions and for
dlarray objects where each dimension except the
first two is a singleton. For example, a 3by4by1
dlarray is a matrix. 
isrow  This function returns true for a
dlarray that is a row vector, where each dimension
except the second is a singleton. For example, a 1by3by1
dlarray is a row vector. 
isscalar  N/A 
isvector  This function returns true for a
dlarray that is a row vector or column vector. Note
that isvector does not consider a 1by1by3
dlarray to be a vector. 
length  N/A 
ndims  If the input 
numel  N/A 
size  If the input 
Creator Functions
Function  Notes and Limitations 

false 

inf  
nan  
ones  
rand  
randi  
randn  
true  
zeros  
createArray (since R2024a) 

String, Character, and Categorical Functions
Visualization Functions
Notable dlarray
Behaviors
Implicit Expansion with Data Formats
Some functions use implicit expansion to combine two
formatted dlarray
inputs. The function introduces labeled singleton
dimensions (dimensions of size 1) into the inputs, as necessary, to make their formats
match. The function inserts singleton dimensions at the end of each block of dimensions
with the same label.
To see an example of this behavior, enter the following code.
X = ones(2,3,2); X = dlarray(X,'SCB') Y = 1:3; Y = dlarray(Y,'C') Z = X.*Y
X = 2(S) × 3(C) × 2(B) dlarray (:,:,1) = 1 1 1 1 1 1 (:,:,2) = 1 1 1 1 1 1 Y = 3(C) × 1(U) dlarray 1 2 3 Z = 2(S) × 3(C) × 2(B) dlarray (:,:,1) = 1 2 3 1 2 3 (:,:,2) = 1 2 3 1 2 3
Z(i,j,k) = X(i,j,k).*Y(j)
for indices
i
, j
, and k
. The second
dimension of Z
(labeled 'C'
) corresponds to the
second dimension of X
and the first dimension of
Y
.In general, the format of one dlarray
input does not need to be a
subset of the format of another dlarray
input. For example, if
X
and Y
are input arguments with
dims(X) = 'SCB'
and dims(Y) = 'SSCT'
, then the
output Z
has dims(Z) = 'SSCBT'
. The
'S'
dimension of X
maps to the first
'S'
dimension of Y
.
Special 'U' Dimension Behavior
The 'U'
dimension of a dlarray
behaves differently
from other labeled dimensions in that it exhibits the standard MATLAB singleton dimension behavior. You can think of a formatted
dlarray
as having infinitely many 'U'
dimensions
of size 1 following the dimensions returned by size
.
The software discards a 'U'
label unless the dimension is
nonsingleton or it is one of the first two dimensions of the
dlarray
.
To see an example of this behavior, enter the following code.
X = ones(2,2);
X = dlarray(X,'SC')
X(:,:,2) = 2
X = 2(S) × 2(C) dlarray 1 1 1 1 X = 2(S) × 2(C) × 2(U) dlarray (:,:,1) = 1 1 1 1 (:,:,2) = 2 2 2 2
dlarray
to a threedimensional dlarray
, and labels the third dimension with
'U'
by default. For an example of how the 'U'
dimension is used in implicit expansion, see Implicit Expansion with Data Formats.Indexing
Indexing with a dlarray
is supported and exhibits the following behaviors:
X(idx1,...,idxn)
returns adlarray
with the same data format asX
ifn
is greater than or equal tondims(X)
. Otherwise, it returns an unformatteddlarray
.If you set
Y(idx1,...,idxn) = X
, then the data format ofY
is preserved, although the software might add or remove trailing'U'
dimension labels. The data format ofX
has no impact on this operation.If you delete parts of a
dlarray
usingX(idx1,…,idxn) = []
, then the data format ofX
is preserved ifn
is greater than or equal tondims(X)
. Otherwise,X
is returned unformatted.
Roundoff Error
When you use a function with a dlarray
input,
the order of the operations within the function can change based on the internal storage order
of the dlarray
. This change can result in differences on the order of roundoff
for two dlarray
objects that are otherwise equal.
See Also
dlarray
 dlgradient
 dlfeval
 dlnetwork
Related Topics
 Define Custom Training Loops, Loss Functions, and Networks
 Train Network Using Custom Training Loop
 Specify Training Options in Custom Training Loop
 Define Model Loss Function for Custom Training Loop
 Update Batch Normalization Statistics in Custom Training Loop
 Make Predictions Using dlnetwork Object
 Train Network Using Model Function
 Update Batch Normalization Statistics Using Model Function
 Make Predictions Using Model Function
 Initialize Learnable Parameters for Model Function