The dag2dlnetwork function applies these adjustments to the network
to make it compatible with dlnetwork workflows:
Remove the output layers — To specify the a loss function when you train a neural
network, specify the loss function using the trainnet
function.
Replace fully connected layers with convolution layers — For neural networks that
require fully connected layers to output data with singleton spatial dimensions, the
dag2dlnetwork function replaces the fully connected layer with
the equivalent convolutional layer. Otherwise, the dag2dlnetwork
function does not replace the layer. In the output dlnetwork object,
the fully connected layer outputs data without spatial dimensions.
For networks that output singleton spatial dimensions, include a flatten layer —
For neural networks that output data with singleton spatial dimensions (for example, a
SqueezeNet neural network), the dag2dlnetwork function adds a
flatten layer at the end of network that removes the singleton spatial
dimensions.
Return an uninitialized network when they contains unsupported layers — If the
network contains layers that dlnetwork objects do not support, then
the function returns an uninitialized dlnetwork object. To remove or
replace unsupported layers in a dlnetwork object, use the removeLayers and replaceLayer functions, respectively.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.