Operations - MATLAB & Simulink (original) (raw)

Develop custom deep learning functions

For most tasks, you can use built-in layers. If there is not a built-in layer that you need for your task, then you can define your own custom layer. You can define custom layers with learnable and state parameters. After you define a custom layer, you can check that the layer is valid, GPU compatible, and outputs correctly defined gradients. To learn more, see Define Custom Deep Learning Layers. For a list of supported layers, see List of Deep Learning Layers.

Use deep learning operations to develop MATLABĀ® code for custom layers, training loops, and model functions.

Functions

expand all

dlarray Deep learning array for customization
dims Data format of dlarray object
finddim Find dimensions with specified label
stripdims Remove dlarray data format
extractdata Extract data from dlarray
isdlarray Check if object is dlarray (Since R2020b)
dlconv Deep learning convolution
dltranspconv Deep learning transposed convolution
lstm Long short-term memory
gru Gated recurrent unit
attention Dot-product attention (Since R2022b)
embed Embed discrete data (Since R2020b)
fullyconnect Sum all weighted input data and apply a bias
dlode45 Deep learning solution of nonstiff ordinary differential equation (ODE) (Since R2021b)
batchnorm Normalize data across all observations for each channel independently
crosschannelnorm Cross channel square-normalize using local responses
groupnorm Normalize data across grouped subsets of channels for each observation independently (Since R2020b)
instancenorm Normalize across each channel for each observation independently (Since R2021a)
layernorm Normalize data across all channels for each observation independently (Since R2021a)
avgpool Pool data to average values over spatial dimensions
maxpool Pool data to maximum value
maxunpool Unpool the output of a maximum pooling operation
relu Apply rectified linear unit activation
leakyrelu Apply leaky rectified linear unit activation
gelu Apply Gaussian error linear unit (GELU) activation (Since R2022b)
softmax Apply softmax activation to channel dimension
sigmoid Apply sigmoid activation
crossentropy Cross-entropy loss for classification tasks
indexcrossentropy Index cross-entropy loss for classification tasks (Since R2024b)
l1loss L1 loss for regression tasks (Since R2021b)
l2loss L2 loss for regression tasks (Since R2021b)
huber Huber loss for regression tasks (Since R2021a)
ctc Connectionist temporal classification (CTC) loss for unaligned sequence classification (Since R2021a)
mse Half mean squared error
dlaccelerate Accelerate deep learning function for custom training loops (Since R2021a)
AcceleratedFunction Accelerated deep learning function (Since R2021a)
clearCache Clear accelerated deep learning function trace cache (Since R2021a)

Topics

Automatic Differentiation

Model Functions

Deep Learning Function Acceleration

Train a Twin Network for Dimensionality Reduction

Train a Twin Network for Dimensionality Reduction

Train a twin neural network with shared weights to compare handwritten digits using dimensionality reduction.

Train a Twin Neural Network to Compare Images

Train a Twin Neural Network to Compare Images

Train a twin neural network with shared weights to identify similar images of handwritten characters.

Image Captioning Using Attention

Image Captioning Using Attention

Train a deep learning model for image captioning using attention.

Sequence-to-Sequence Translation Using Attention

Sequence-to-Sequence Translation Using Attention

Convert decimal strings to Roman numerals using a recurrent sequence-to-sequence encoder-decoder model with attention.

Solve PDE Using Physics-Informed Neural Network

Solve PDE Using Physics-Informed Neural Network

Train a physics-informed neural network (PINN) to predict the solutions of an partial differential equation (PDE).

Dynamical System Modeling Using Neural ODE

Dynamical System Modeling Using Neural ODE

Train a neural network with neural ordinary differential equations (ODEs) to learn the dynamics of a physical system.

Node Classification Using Graph Convolutional Network

Node Classification Using Graph Convolutional Network

Classify nodes in a graph using a graph convolutional network (GCN).

Multilabel Graph Classification Using Graph Attention Networks

Multilabel Graph Classification Using Graph Attention Networks

Classify graphs that have multiple independent labels using graph attention networks (GATs).

Train Latent ODE Network with Irregularly Sampled Time-Series Data

Train Latent ODE Network with Irregularly Sampled Time-Series Data

Train a latent ordinary differential equation (ODE) autoencoder with time-series data that is sampled at irregular time intervals.

Multivariate Time Series Anomaly Detection Using Graph Neural Network

Multivariate Time Series Anomaly Detection Using Graph Neural Network

Detect anomalies in multivariate time series data using a graph neural network (GNN).