supported networks, layers, and classes
supported pretrained networks
gpu coder™ supports code generation for series and directed acyclic graph (dag) convolutional neural networks (cnns or convnets). you can generate code for any trained convolutional neural network whose layers are supported for code generation. see supported layers. you can train a convolutional 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.
network name | description | cudnn | tensorrt | arm® compute library for mali gpu |
---|---|---|---|---|
alexnet | alexnet convolutional neural network. for the pretrained alexnet model, see (deep learning toolbox). the syntax | yes | yes | yes |
caffe network | convolutional neural network models from caffe. for importing a pretrained network from caffe, see (deep learning toolbox). | yes | yes | yes |
darknet-19 | darknet-19 convolutional neural network. for more information, see (deep learning toolbox). the syntax | yes | yes | yes |
darknet-53 | darknet-53 convolutional neural network. for more information, see (deep learning toolbox). the syntax | yes | yes | yes |
deeplab v3 | deeplab v3 convolutional neural network. for more information, see (computer vision toolbox). | yes | yes | no |
densenet-201 | densenet-201 convolutional neural network. for the pretrained densenet-201 model, see (deep learning toolbox). the syntax | yes | yes | yes |
efficientnet-b0 | efficientnet-b0 convolutional neural network. for the pretrained efficientnet-b0 model, see (deep learning toolbox). the syntax
| yes | yes | yes |
googlenet | googlenet convolutional neural network. for the pretrained googlenet model, see (deep learning toolbox). the syntax | yes | yes | yes |
inception-resnet-v2 | inception-resnet-v2 convolutional neural network. for the pretrained inception-resnet-v2 model, see (deep learning toolbox). | yes | yes | no |
inception-v3 | inception-v3 convolutional neural network. for the pretrained inception-v3 model, see (deep learning toolbox). the syntax | yes | yes | yes |
mobilenet-v2 | mobilenet-v2 convolutional neural network. for the pretrained mobilenet-v2 model, see (deep learning toolbox). the syntax | yes | yes | yes |
nasnet-large | nasnet-large convolutional neural network. for the pretrained nasnet-large model, see (deep learning toolbox). | yes | yes | no |
nasnet-mobile | nasnet-mobile convolutional neural network. for the pretrained nasnet-mobile model, see (deep learning toolbox). | yes | yes | no |
resnet | resnet-18, resnet-50, and resnet-101 convolutional neural networks. for the pretrained resnet models, see (deep learning toolbox), (deep learning toolbox), and (deep learning toolbox). the syntax | yes | yes | yes |
segnet | multi-class pixelwise segmentation network. for more information, see (computer vision toolbox). | yes | yes | no |
squeezenet | small deep neural network. for the pretrained squeezenet models, see (deep learning toolbox). the syntax | yes | yes | yes |
vgg-16 | vgg-16 convolutional neural network. for the pretrained vgg-16 model, see (deep learning toolbox). the syntax | yes | yes | yes |
vgg-19 | vgg-19 convolutional neural network. for the pretrained vgg-19 model, see (deep learning toolbox). the syntax | yes | yes | yes |
xception | xception convolutional neural network. for the pretrained xception model, see (deep learning toolbox). the syntax | yes | yes | yes |
yolo v2 | you only look once version 2 convolutional neural network based object detector. for more information, see (computer vision toolbox) | yes | yes | yes |
supported layers
the following layers are supported for code generation by gpu coder for the target deep learning libraries specified in the table.
input layers
layer name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
(deep learning toolbox) | an image input layer inputs 2-d images to a network and applies data normalization. code generation does not support
| yes | yes | yes |
(deep learning toolbox) | a sequence input layer inputs sequence data to a network. the cudnn library supports vector and 2-d image sequences. the tensorrt library support only vector input sequences. for vector sequence inputs, the number of features must be a constant during code generation. for image sequence inputs, the height, width, and the number of channels must be a constant during code generation. code
generation does not support | yes | yes | no |
(deep learning toolbox) | a feature input layer inputs feature data to a network and applies data normalization. | yes | yes | yes |
convolution and fully connected layers
layer name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
(deep learning toolbox) | a 2-d convolutional layer applies sliding convolutional filters to the input. | yes | yes | yes |
| a fully connected layer multiplies the input by a weight matrix and then adds a bias vector. | yes | yes | no |
(deep learning toolbox) | a 2-d grouped convolutional layer separates the input channels into groups and applies sliding convolutional filters. use grouped convolutional layers for channel-wise separable (also known as depth-wise separable) convolution. code generation for
the arm mali gpu is not supported for a 2-d grouped
convolution layer that has the | yes | yes | yes |
(deep learning toolbox) | a transposed 2-d convolution layer upsamples feature maps. | yes | yes | yes |
sequence layers
layer name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
(deep learning toolbox) | a bidirectional lstm (bilstm) layer learns bidirectional long-term dependencies between time steps of time series or sequence data. these dependencies can be useful when you want the network to learn from the complete time series at each time step. for code generation, the
for code generation, the
| yes | yes | no |
(deep learning toolbox) | a flatten layer collapses the spatial dimensions of the input into the channel dimension. | yes | no | no |
(deep learning toolbox) | a gru layer learns dependencies between time steps in time series and sequence data. code generation supports only
the | yes | yes | no |
(deep learning toolbox) | an lstm layer learns long-term dependencies between time steps in time series and sequence data. for code generation,
the for code generation, the
| yes | yes | no |
(deep learning toolbox) | a sequence folding layer converts a batch of image sequences to a batch of images. use a sequence folding layer to perform convolution operations on time steps of image sequences independently. | yes | no | no |
(deep learning toolbox) | a sequence input layer inputs sequence data to a network. the cudnn library supports vector and 2-d image sequences. the tensorrt library support only vector input sequences. for vector sequence inputs, the number of features must be a constant during code generation. for image sequence inputs, the height, width, and the number of channels must be a constant during code generation. code
generation does not support | yes | yes | no |
(deep learning toolbox) | a sequence unfolding layer restores the sequence structure of the input data after sequence folding. | yes | no | no |
(text analytics toolbox) | a word embedding layer maps word indices to vectors. | yes | yes | no |
activation layers
layer name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
(deep learning toolbox) | a clipped relu layer performs a threshold operation, where any input value less than zero is set to zero and any value above the clipping ceiling is set to that clipping ceiling. | yes | yes | yes |
(deep learning toolbox) | an elu activation layer performs the identity operation on positive inputs and an exponential nonlinearity on negative inputs. | yes | yes | no |
(deep learning toolbox) | a leaky relu layer performs a threshold operation, where any input value less than zero is multiplied by a fixed scalar. | yes | yes | yes |
(deep learning toolbox) | a relu layer performs a threshold operation to each element of the input, where any value less than zero is set to zero. | yes | yes | yes |
(reinforcement learning toolbox) | a | yes | yes | no |
(deep learning toolbox) | a swish activation layer applies the swish function on the layer inputs. | yes | yes | no |
(deep learning toolbox) | a hyperbolic tangent (tanh) activation layer applies the tanh function on the layer inputs. | yes | yes | yes |
normalization, dropout, and cropping layers
layer name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
(deep learning toolbox) | a batch normalization layer normalizes each input channel across a mini-batch. | yes | yes | yes |
(deep learning toolbox) | a 2-d crop layer applies 2-d cropping to the input. | yes | yes | yes |
(deep learning toolbox) | a channel-wise local response (cross-channel) normalization layer carries out channel-wise normalization. | yes | yes | yes |
(deep learning toolbox) | a dropout layer randomly sets input elements to zero with a given probability. | yes | yes | yes |
(deep learning toolbox) | a group normalization layer normalizes a mini-batch of data across grouped subsets of channels for each observation independently. | yes | yes | no |
(reinforcement learning toolbox) | scaling layer for actor or critic network. for code
generation, values for the | yes | yes | yes |
pooling and unpooling layers
layer name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
(deep learning toolbox) | an average pooling layer performs down-sampling by dividing the input into rectangular pooling regions and computing the average values of each region. code generation using third-party
libraries such as for simulink® models that implement deep learning functionality using matlab function block, simulation errors out if the network contains an average pooling layer with non-zero padding value. in such cases, use the blocks from the deep neural networks library instead of a matlab function to implement the deep learning functionality. | yes | yes | yes |
(deep learning toolbox) | a global average pooling layer performs down-sampling by computing the mean of the height and width dimensions of the input. | yes | yes | yes |
(deep learning toolbox) | a global max pooling layer performs down-sampling by computing the maximum of the height and width dimensions of the input. | yes | yes | yes |
(deep learning toolbox) | a max pooling layer performs down-sampling by dividing the input into rectangular pooling regions, and computing the maximum of each region. if equal max values exists along the
off-diagonal in a kernel window, implementation differences for the
| yes | yes | yes |
(deep learning toolbox) | a max unpooling layer unpools the output of a max pooling layer. if equal max values exists along the off-diagonal
in a kernel window, implementation differences for the
| yes | yes | no |
combination layers
layer name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
(deep learning toolbox) | an addition layer adds inputs from multiple neural network layers element-wise. | yes | yes | yes |
(deep learning toolbox) | a concatenation layer takes inputs and concatenates them along a specified dimension. | yes | yes | no |
(deep learning toolbox) | a depth concatenation layer takes inputs that have the same height and width and concatenates them along the third dimension (the channel dimension). | yes | yes | yes |
object detection layers
layer name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
(computer vision toolbox) | an anchor box layer stores anchor boxes for a feature map used in object detection networks. | yes | yes | yes |
(image processing toolbox) | a 2-d depth to space layer permutes data from the depth dimension into blocks of 2-d spatial data. | yes | yes | yes |
(computer vision toolbox) | a focal loss layer predicts object classes using focal loss. | yes | yes | yes |
(image processing toolbox) | a space to depth layer permutes the spatial blocks of the input into the depth dimension. use this layer when you need to combine feature maps of different size without discarding any feature data. | yes | yes | yes |
(computer vision toolbox) | an ssd merge layer merges the outputs of feature maps for subsequent regression and classification loss computation. | yes | yes | no |
(computer vision toolbox) | a box regression layer refines bounding box locations by using a smooth l1 loss function. use this layer to create a fast or faster r-cnn object detection network. | yes | yes | yes |
(computer vision toolbox) | a region proposal network (rpn) classification layer classifies image regions as either object or background by using a cross entropy loss function. use this layer to create a faster r-cnn object detection network. | yes | yes | yes |
(computer vision toolbox) | create output layer for yolo v2 object detection network. | yes | yes | yes |
(computer vision toolbox) | create reorganization layer for yolo v2 object detection network. | yes | yes | yes |
(computer vision toolbox) | create transform layer for yolo v2 object detection network. | yes | yes | yes |
output layers
layer name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
(deep learning toolbox) | a classification layer computes the cross entropy loss for multi-class classification problems with mutually exclusive classes. | yes | yes | yes |
(computer vision toolbox) | a dice pixel classification layer provides a categorical label for each image pixel or voxel using generalized dice loss. | yes | yes | yes |
(computer vision toolbox) | a focal loss layer predicts object classes using focal loss. | yes | yes | yes |
| all output layers including custom classification or regression
output layers created by using
for an example showing how to define a custom classification output layer and specify a loss function, see (deep learning toolbox). for an example showing how to define a custom regression output layer and specify a loss function, see (deep learning toolbox). | yes | yes | yes |
(computer vision toolbox) | a pixel classification layer provides a categorical label for each image pixel or voxel. | yes | yes | yes |
(computer vision toolbox) | a box regression layer refines bounding box locations by using a smooth l1 loss function. use this layer to create a fast or faster r-cnn object detection network. | yes | yes | yes |
(deep learning toolbox) | a regression layer computes the half-mean-squared-error loss for regression problems. | yes | yes | yes |
(computer vision toolbox) | a region proposal network (rpn) classification layer classifies image regions as either object or background by using a cross entropy loss function. use this layer to create a faster r-cnn object detection network. | yes | yes | yes |
(deep learning toolbox) | a sigmoid layer applies a sigmoid function to the input. | yes | yes | yes |
(deep learning toolbox) | a softmax layer applies a softmax function to the input. | yes | yes | yes |
custom keras layers
layer name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
| clips the input between the upper and lower bounds. | yes | yes | no |
| flatten activations into 1-d assuming c-style (row-major) order. | yes | yes | yes |
| global average pooling layer for spatial data. | yes | yes | yes |
| parametric rectified linear unit. | yes | yes | no |
| sigmoid activation layer. | yes | yes | yes |
| hyperbolic tangent activation layer. | yes | yes | yes |
| flatten a sequence of input image into a sequence of vector, assuming c-style (or row-major) storage ordering of the input layer. | yes | yes | no |
| zero padding layer for 2-d input. | yes | yes | yes |
custom onnx layers
layer name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
| clips the input between the upper and lower bounds. | yes | yes | no |
| layer that performs element-wise scaling of the input followed by an addition. | yes | yes | yes |
| flattens a matlab 2d image batch in the way onnx does, producing a 2d
output array with | yes | yes | no |
| flattens the spatial dimensions of the input tensor to the channel dimensions. | yes | yes | yes |
| global average pooling layer for spatial data. | yes | yes | yes |
| layer that implements onnx identity operator. | yes | yes | yes |
| parametric rectified linear unit. | yes | yes | no |
| sigmoid activation layer. | yes | yes | yes |
| hyperbolic tangent activation layer. | yes | yes | yes |
| verify fixed batch size. | yes | yes | yes |
custom layers
layer name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
| custom layers, with or without learnable parameters, that you define for your problem. to learn how to define custom deep learning layers, see (deep learning toolbox) and (deep learning toolbox). for an example on how to generate code for a network with custom layers, see code generation for object detection using yolo v3 deep learning network. the outputs of the custom layer must be fixed-size arrays. using cudnn targets support both row-major and column-major code generation for custom layers. tensorrt targets support only column-major code generation. for code generation,
custom layers must contain the code generation for a sequence network containing custom layer and lstm or gru layer is not supported. you can pass
for unsupported 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 | yes | yes | no |
supported classes
the following classes are supported for code generation by gpu coder for the target deep learning libraries specified in the table.
name | description | cudnn | tensorrt | arm compute library for mali gpu |
---|---|---|---|---|
(deep learning toolbox) | directed acyclic graph (dag) network for deep learning
| yes | yes | yes |
(deep learning toolbox) | deep learning network for custom training loops
| yes | yes | no |
(lidar toolbox) | pointpillars network to detect objects in lidar point clouds
| yes | yes | no |
(deep learning toolbox) | series network for deep learning
| yes | yes | yes |
(computer vision toolbox) | detect objects using the ssd-based detector.
| yes | yes | no |
(computer vision toolbox) | detect objects using yolo v2 object detector
| yes | yes | yes |
(computer vision toolbox) | detect objects using yolo v3 object detector
| yes | yes | no |
(computer vision toolbox) | detect objects using yolo v4 object detector
| yes | yes | no |
see also
functions
- |
codegen
|
objects
- | | | | |
related topics
- pretrained deep neural networks (deep learning toolbox)
- (deep learning toolbox)
- (deep learning toolbox)