Main Content

Supported Networks, Layers, and Classes

R2026b

GPU Coder™ supports code generation for series and directed acyclic graph (DAG) neural networks. This page provides a list of supported deep learning networks, layers and classes.

Note that the code generator represents characters in an 8-bit ASCII code set that the locale setting determines. Therefore, the use of non-ASCII characters in class names, layer names, layer description, or network names might result in errors. For more information, see Encoding of Characters in Code Generation.

Supported Pretrained Networks

You can train a neural network on either a CPU, a GPU, or multiple GPUs by using the Deep Learning Toolbox™ or use one of the pretrained networks listed in the table and generate CUDA® code.

These pretrained networks, available in Deep Learning Toolbox, are supported for code generation. You can use imagePretrainedNetwork (Deep Learning Toolbox) function to load these pretrained neural networks as dlnetwork (Deep Learning Toolbox) objects for code generation. Note that code generation does not support setting the name-value argument Weights of imagePretrainedNetwork function to "none". For example, use this code to load a pretrained GoogLeNet neural network.

net = imagePretrainedNetwork("googlenet")

imagePretrainedNetwork Model Name ArgumentCUDATensorRT and cuDNN

"alexnet"

"darknet19"

"darknet53"

"densenet201"

"efficientnetb0"

"googlenet"

"inceptionresnetv2"

"inceptionv3"

"mobilenetv2"

"nasnetlarge"

 

"nasnetmobile"

 

"resnet18"

"resnet50"

"resnet101"

"shufflenet"

 

"squeezenet"

"vgg16"

"vgg19"

"xception"

Additionally, you can use these functions to create neural networks for code generation.

Network NameCUDATensorRT and cuDNN

Caffe network

See importCaffeNetwork (Deep Learning Toolbox).

DeepLab v3+ network

deeplabv3plus (Computer Vision Toolbox)

 

Supported Layers

These layers are supported for code generation by GPU Coder for these target deep learning libraries.

Note

In the following tables, the information icon indicates that the network, layer, or class has limited code generation capabilities. You might see errors and unexpected behavior. For more information, see the Extended Capabilities section on the page for that network, layer, or class.

Input Layers

Layer NameCUDATensorRTcuDNN

imageInputLayer (Deep Learning Toolbox)

sequenceInputLayer (Deep Learning Toolbox)

featureInputLayer (Deep Learning Toolbox)

Convolution and Fully Connected Layers

Layer NameCUDATensorRT and cuDNN

convolution1dLayer (Deep Learning Toolbox)

 

convolution2dLayer (Deep Learning Toolbox)

fullyConnectedLayer (Deep Learning Toolbox)

groupedConvolution2dLayer (Deep Learning Toolbox)

 

transposedConv1dLayer (Deep Learning Toolbox)

 

transposedConv2dLayer (Deep Learning Toolbox)

spectralConvolution1dLayer (Deep Learning Toolbox)

 

spectralConvolution2dLayer (Deep Learning Toolbox)

 

spectralConvolution3dLayer (Deep Learning Toolbox)

 

Sequence Layers

Layer NameCUDATensorRT and cuDNN

sequenceInputLayer (Deep Learning Toolbox)

bilstmLayer (Deep Learning Toolbox)

flattenLayer (Deep Learning Toolbox)

gruLayer (Deep Learning Toolbox)

lstmLayer (Deep Learning Toolbox)

wordEmbeddingLayer (Text Analytics Toolbox)

Activation Layers

Layer NameCUDATensorRT and cuDNN

clippedReluLayer (Deep Learning Toolbox)

eluLayer (Deep Learning Toolbox)

leakyReluLayer (Deep Learning Toolbox)

preluLayer (Deep Learning Toolbox)

reluLayer (Deep Learning Toolbox)

gelu (Deep Learning Toolbox)

softplusLayer (Deep Learning Toolbox)

swishLayer (Deep Learning Toolbox)

tanhLayer (Deep Learning Toolbox)

Utility Layers

Layer NameCUDATensorRT and cuDNN

batchNormalizationLayer (Deep Learning Toolbox)

crop2dLayer (Deep Learning Toolbox)

crossChannelNormalizationLayer (Deep Learning Toolbox)

dropoutLayer (Deep Learning Toolbox)

formatLayer (Deep Learning Toolbox)

groupNormalizationLayer (Deep Learning Toolbox)

instanceNormalizationLayer (Deep Learning Toolbox)

inverseNormalizationLayer (Deep Learning Toolbox)

layerNormalizationLayer (Deep Learning Toolbox)

reshapeLayer (Deep Learning Toolbox)

 

scalingLayer (Deep Learning Toolbox)

sliceLayer (Deep Learning Toolbox)

spatialDropoutLayer (Deep Learning Toolbox)

Pooling and Unpooling Layers

Layer NameCUDATensorRT and cuDNN
adaptiveAveragePooling2dLayer (Deep Learning Toolbox)

averagePooling1dLayer (Deep Learning Toolbox)

 

averagePooling2dLayer (Deep Learning Toolbox)

globalAveragePooling1dLayer (Deep Learning Toolbox)

 

globalAveragePooling2dLayer (Deep Learning Toolbox)

globalMaxPooling1dLayer (Deep Learning Toolbox)

 

globalMaxPooling2dLayer (Deep Learning Toolbox)

maxPooling1dLayer (Deep Learning Toolbox)

 

maxPooling2dLayer (Deep Learning Toolbox)

maxUnpooling2dLayer (Deep Learning Toolbox)

 

waveletPooling1dLayer (Wavelet Toolbox) (since R2026b)

 

waveletPooling2dLayer (Wavelet Toolbox) (since R2026b)

 

Combination Layers

Layer NameCUDATensorRT and cuDNN

additionLayer (Deep Learning Toolbox)

concatenationLayer (Deep Learning Toolbox)

depthConcatenationLayer (Deep Learning Toolbox)

Transformer Layers

Layer NameCUDATensorRT and cuDNN

attentionLayer (Deep Learning Toolbox)

 

embeddingConcatenationLayer (Deep Learning Toolbox)

 

embeddingLayer (Deep Learning Toolbox)

 

indexing1dLayer (Deep Learning Toolbox)

 

patchEmbeddingLayer (Computer Vision Toolbox)

 

positionEmbeddingLayer (Deep Learning Toolbox)

 

selfAttentionLayer (Deep Learning Toolbox)

 

sinusoidalPositionEncodingLayer (Deep Learning Toolbox)

 

Object Detection Layers

Layer NameCUDATensorRT and cuDNN

depthToSpace2dLayer (Image Processing Toolbox)

spaceToDepthLayer (Image Processing Toolbox)

 

ssdMergeLayer (Computer Vision Toolbox)

yolov2TransformLayer (Computer Vision Toolbox)

Signal Transform Layers

Layer NameCUDATensorRT and cuDNN

cwtLayer (Wavelet Toolbox) (since R2026a)

 

icwtLayer (Wavelet Toolbox) (since R2026a)

 

istftLayer (Signal Processing Toolbox) (since R2025a)

 

modwtLayer (Wavelet Toolbox) (since R2025a)

 

stftLayer (Signal Processing Toolbox) (since R2025a)

 

Output Layers

Layer NameCUDATensorRT and cuDNN

classificationLayer (Deep Learning Toolbox)

regressionLayer (Deep Learning Toolbox)

sigmoidLayer (Deep Learning Toolbox)

softmaxLayer (Deep Learning Toolbox)

Custom Output Layer (Deep Learning Toolbox)

  • An output layer including custom classification or regression output layers created by nnet.layer.ClassificationLayer or nnet.layer.RegressionLayer functions.

  • For an example showing how to define a custom classification output layer and specify a loss function, see Define Custom Classification Output Layer (Deep Learning Toolbox).

  • For an example showing how to define a custom regression output layer and specify a loss function, see Define Custom Regression Output Layer (Deep Learning Toolbox).

Custom Keras Layers

Layer NameCUDATensorRT and cuDNN

nnet.keras.layer.ClipLayer (Deep Learning Toolbox)

nnet.keras.layer.FlattenCStyleLayer (Deep Learning Toolbox)

nnet.keras.layer.GlobalAveragePooling2dLayer (Deep Learning Toolbox)

nnet.keras.layer.PreluLayer (Deep Learning Toolbox)

nnet.keras.layer.SigmoidLayer (Deep Learning Toolbox)

nnet.keras.layer.TanhLayer (Deep Learning Toolbox)

nnet.keras.layer.TimeDistributedFlattenCStyleLayer (Deep Learning Toolbox)

nnet.keras.layer.ZeroPadding2dLayer (Deep Learning Toolbox)

Custom ONNX Layers

Layer NameCUDATensorRT and cuDNN

nnet.onnx.layer.ClipLayer (Deep Learning Toolbox)

nnet.onnx.layer.ElementwiseAffineLayer (Deep Learning Toolbox)

nnet.onnx.layer.FlattenInto2dLayer (Deep Learning Toolbox)

nnet.onnx.layer.FlattenLayer (Deep Learning Toolbox)

nnet.onnx.layer.GlobalAveragePooling2dLayer (Deep Learning Toolbox)

nnet.onnx.layer.IdentityLayer (Deep Learning Toolbox)

nnet.onnx.layer.PreluLayer (Deep Learning Toolbox)

nnet.onnx.layer.SigmoidLayer (Deep Learning Toolbox)

nnet.onnx.layer.TanhLayer (Deep Learning Toolbox)

nnet.onnx.layer.VerifyBatchSizeLayer (Deep Learning Toolbox)

Custom PyTorch Layers

Layer NameCUDATensorRT and cuDNN

nnet.pytorch.layer.AdaptiveAveragePoolingLayer (Deep Learning Toolbox)

 

nnet.pytorch.layer.AttentionMaskTransformLayer (Deep Learning Toolbox)

 

nnet.pytorch.layer.ConcatLayer (Deep Learning Toolbox)

 

nnet.pytorch.layer.CustomInputLayer (Deep Learning Toolbox)

 

nnet.pytorch.layer.CustomOutputLayer (Deep Learning Toolbox)

 

nnet.pytorch.layer.FeatureDropoutLayer (Deep Learning Toolbox)

 

nnet.pytorch.layer.Flatten2DLayer (Deep Learning Toolbox)

 

nnet.pytorch.layer.IdentityLayer (Deep Learning Toolbox)

 

nnet.pytorch.layer.PReLULayer (Deep Learning Toolbox)

 

nnet.pytorch.layer.PaddingMaskTransformLayer (Deep Learning Toolbox)

 

nnet.pytorch.layer.PassthroughLayer (Deep Learning Toolbox)

 

nnet.pytorch.layer.SoftmaxLayer (Deep Learning Toolbox)

 

Custom Layers

Layer NameCUDATensorRT and cuDNN

Custom layers

  • The outputs of the custom layer must be fixed-size arrays.

  • Setting the Malloc mode parameter in the GPU Coder app to unified requires extra memory copies, which leads to slower performance. It is recommended to use "discrete". For more information on GPU memory allocation, see Malloc mode.

  • cuDNN targets support both row-major and column-major code generation for custom layers. TensorRT targets support only column-major code generation.

  • Custom layers must contain the %#codegen pragma.

  • A sequence network that contains custom layers and LSTM or GRU layers is not supported.

  • You can pass dlarray to custom layers if:

    • The custom layer is in dlnetwork.

    • The custom layer is in a DAG or series network and either inherits from nnet.layer.Formattable or has no backward propagation.

  • For unsupported dlarray methods, you must extract the underlying data from the dlarray, perform the computations, and reconstruct the data into the dlarray object. For example:

    function Z = predict(layer, X)
    
    if coder.target('MATLAB')
       Z = doPredict(X);
    else
       if isdlarray(X)
          X1 = extractdata(X);
          Z1 = doPredict(X1);
          Z = dlarray(Z1);
      else
          Z = doPredict(X);
      end
    end
    
    end
    

Supported Classes

These classes are supported for code generation by GPU Coder for these target deep learning libraries.

NameCUDATensorRT and cuDNN

dlnetwork (Deep Learning Toolbox)

DAGNetwork (Deep Learning Toolbox)

pointPillarsObjectDetector (Point Cloud Toolbox)

SeriesNetwork (Deep Learning Toolbox)

ssdObjectDetector (Computer Vision Toolbox)

yolov2ObjectDetector (Computer Vision Toolbox)

yolov3ObjectDetector (Computer Vision Toolbox)

yolov4ObjectDetector (Computer Vision Toolbox)

yoloxObjectDetector (Visual Inspection Toolbox)

peopleDetector (Computer Vision Toolbox) (since R2025a)

 

See Also

Functions

Objects

Topics