Main Content

Build Deep Neural Networks

Build networks for sequence and tabular data using MATLAB® code or interactively using Deep Network Designer

Create new deep networks for tasks such as classification, regression, and forecasting by defining the network architecture from scratch. Build networks using MATLAB or interactively using Deep Network Designer.

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 specify a custom loss function using a custom output layer and define custom layers with learnable and state parameters. After defining a custom layer, you can check that the layer is valid, GPU compatible, and outputs correctly defined gradients. For a list of supported layers, see List of Deep Learning Layers.

For models that layer graphs do not support, you can define a custom model as a function. To learn more, see Define Custom Training Loops, Loss Functions, and Networks.

Apps

Deep Network DesignerDesign, visualize, and train deep learning networks

Functions

expand all

Input Layers

sequenceInputLayerSequence input layer
featureInputLayerFeature input layer

Recurrent Layers

lstmLayerLong short-term memory (LSTM) layer for recurrent neural network (RNN)
bilstmLayerBidirectional long short-term memory (BiLSTM) layer for recurrent neural network (RNN)
gruLayerGated recurrent unit (GRU) layer for recurrent neural network (RNN)
lstmProjectedLayerLong short-term memory (LSTM) projected layer for recurrent neural network (RNN)

Convolution, Attention, and Fully Connected Layers

convolution1dLayer1-D convolutional layer
transposedConv1dLayerTransposed 1-D convolution layer
selfAttentionLayerSelf-attention layer
fullyConnectedLayerFully connected layer

Activation and Dropout Layers

reluLayerRectified Linear Unit (ReLU) layer
leakyReluLayerLeaky Rectified Linear Unit (ReLU) layer
clippedReluLayerClipped Rectified Linear Unit (ReLU) layer
eluLayerExponential linear unit (ELU) layer
tanhLayerHyperbolic tangent (tanh) layer
swishLayerSwish layer
geluLayerGaussian error linear unit (GELU) layer
sigmoidLayerSigmoid layer
softmaxLayerSoftmax layer
dropoutLayerDropout layer
functionLayerFunction layer

Normalization Layers

batchNormalizationLayerBatch normalization layer
groupNormalizationLayerGroup normalization layer
instanceNormalizationLayerInstance normalization layer
layerNormalizationLayerLayer normalization layer
crossChannelNormalizationLayer Channel-wise local response normalization layer

Pooling Layers

maxPooling1dLayer1-D max pooling layer
averagePooling1dLayer1-D average pooling layer
globalMaxPooling1dLayer1-D global max pooling layer
globalAveragePooling1dLayer1-D global average pooling layer

Combination Layers

additionLayerAddition layer
multiplicationLayerMultiplication layer
concatenationLayerConcatenation layer
depthConcatenationLayerDepth concatenation layer

Data Manipulation

sequenceFoldingLayerSequence folding layer
sequenceUnfoldingLayerSequence unfolding layer
flattenLayerFlatten layer

Output Layers

classificationLayerClassification output layer
regressionLayerRegression output layer
layerGraphGraph of network layers for deep learning
plotPlot neural network architecture
addLayersAdd layers to layer graph or network
removeLayersRemove layers from layer graph or network
replaceLayerReplace layer in layer graph or network
connectLayersConnect layers in layer graph or network
disconnectLayersDisconnect layers in layer graph or network
DAGNetworkDirected acyclic graph (DAG) network for deep learning
isequalCheck equality of deep learning layer graphs or networks
isequalnCheck equality of deep learning layer graphs or networks ignoring NaN values
analyzeNetworkAnalyze deep learning network architecture
dlnetworkDeep learning network for custom training loops
addInputLayerAdd input layer to network
summaryPrint network summary
initializeInitialize learnable and state parameters of a dlnetwork
networkDataLayoutDeep learning network data layout for learnable parameter initialization
checkLayerCheck validity of custom or function layer

Topics

Built-In Layers

Custom Layers