NetRename

NetRename[net,"old""new"]

gives a net in which the name old for a layer is replaced with new.

NetRename[net,{rule1,rule2,}]

performs all renamings specified by the rulei.

NetRename[net,f]

use a function f to map existing layer names to new names.

Details

  • NetRename can only be used on NetChain and NetGraph objects that were created using an association syntax of the form <|"name1"->layer1,"name2"->layer2,|>.
  • NetRename will only perform renaming at the outermost level of a NetChain or NetGraph. It will not affect nested chains and graphs.

Examples

open allclose all

Basic Examples  (4)

Rename a single layer in a NetChain:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Rename a single layer in a NetGraph:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Rename multiple layers simultaneously:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Rename layers using a renaming function:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Possible Issues  (1)

See Also

NetReplace  NetReplacePart  NetExtract  NetFlatten  NetDelete  NetInsert  NetTake  NetDrop  NetAppend  NetPrepend  NetChain  NetGraph

Tutorials

Introduced in 2018
(11.3)