dag2dlnetwork
Description
Examples
Convert SeriesNetwork
Object to dlnetwork
Load a trained SeriesNetwork
object into the workspace and inspect it.
load digitsSeriesNet
net
net = SeriesNetwork with properties: Layers: [15x1 nnet.cnn.layer.Layer] InputNames: {'imageinput'} OutputNames: {'classoutput'}
Convert the network to a dlnetwork
object.
dlnet = dag2dlnetwork(net)
dlnet = dlnetwork with properties: Layers: [14x1 nnet.cnn.layer.Layer] Connections: [13x2 table] Learnables: [14x3 table] State: [6x3 table] InputNames: {'imageinput'} OutputNames: {'softmax'} Initialized: 1 View summary with summary.
Input Arguments
net
— Input network
SeriesNetwork
object | DAGNetwork
object
Input network, specified as a SeriesNetwork
or
DAGNetwork
object.
Output Arguments
dlnet
— Converted network
dlnetwork
object
Converted network, returned as a dlnetwork
object.
Algorithms
dlnetwork
Conversion
The dag2dlnetwork
function applies these adjustments to the input
network to make it compatible with dlnetwork
functionality:
Remove the output layers — To specify the loss function when you train a neural network, use 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, thedag2dlnetwork
function does not replace the layer. In the outputdlnetwork
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 uninitializeddlnetwork
object. To remove or replace unsupported layers in adlnetwork
object, use theremoveLayers
andreplaceLayer
functions, respectively.
Version History
Introduced in R2024a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
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.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)