Function Repository Resource:

NetChainToGraph

Source Notebook

Convert a NetChain to a NetGraph

Contributed by: Aster Ctor

ResourceFunction["NetChainToGraph"][chain]

convert the NetChain chain to a NetGraph.

Examples

Basic Examples (4) 

Use LeNet as an example:

In[1]:=
lenet = NetModel["LeNet Trained on MNIST Data"]
Out[1]=

Its head is NetChain:

In[2]:=
Head@lenet
Out[2]=

Convert it to a NetGraph:

In[3]:=
graph = ResourceFunction["NetChainToGraph"]@lenet
Out[3]=

Now the head is NetGraph:

In[4]:=
Head@graph
Out[4]=

Scope (2) 

Take VGG as an example:

In[5]:=
vgg = NetModel["VGG-16 Trained on ImageNet Competition Data"]
Out[5]=

If each layer has a name, the name will be inherited:

In[6]:=
ResourceFunction["NetChainToGraph"]@vgg
Out[6]=

Publisher

Aster Ctor (MoeNet)

Version History

  • 1.0.0 – 16 December 2019

License Information