Starting in R2024a, SeriesNetwork
, DAGNetwork
, and
LayerGraph
objects are not recommended. Use dlnetwork
objects instead. This recommendation means that
SeriesNetwork
, DAGNetwork
, and
LayerGraph
input to the isequal
function is not
recommended.
For SeriesNetwork
, DAGNetwork
, and
LayerGraph
, the isequal
function has this behavior:
If both inputs are SeriesNetwork
or DAGNetwork
objects, or one of each, then the function returns 1
(true
) when the properties and architectures match. Otherwise,
the function returns 0
(false
).
If both inputs are LayerGraph
objects, then the function returns
1
(true
) when the properties and architectures
match. Otherwise, the function returns 0
(false
).
For other combinations, the function returns 0
(false
).
Most functions that support LayerGraph
objects also support
dlnetwork
objects. This table shows some typical usages of
LayerGraph
objects and how to update your code to use
dlnetwork
object functions instead.
Not Recommended | Recommended |
---|
lgraph = layerGraph; | net = dlnetwork; |
lgraph = layerGraph(layers); | net = dlnetwork(layers,Initialize=false); |
lgraph = layerGraph(net); | net = dag2dlnetwork(net); |
lgraph = addLayers(lgraph,layers); | net = addLayers(net,layers); |
lgraph = removeLayers(lgraph,layerNames); | net = removeLayers(net,layerNames); |
lgraph =
replaceLayer(lgraph,layerName,layers); | net = replaceLayer(net,layerName,layers); |
lgraph = connectLayers(lgraph,s,d); | net = connectLayers(net,s,d); |
lgraph = disconnectLayers(lgraph,s,d); | net = disconnectLayers(net,s,d); |
plot(lgraph); | plot(net); |
To train a neural network specified as a dlnetwork
object,
use the trainnet
function.