NetInsert

NetInsert[chain,layer,i]

inserts a layer into a NetChain before the layer at position i.

NetInsert[chain,"name"->layer,"pos"]

inserts a named layer into a NetChain before the layer at the given position.

Details

  • If a chain was created using the association form <|"name1"->layer1,"name2"->layer2,|>, then NetInsert[chain,"name"->layer,pos] should be used.
  • If a chain was created using the list form {layer1,layer2,}, then NetInsert[chain,layer,i] should be used.
  • The inserted layer must be compatible with the output of the previous layer and the input of the next layer.

Examples

open allclose all

Basic Examples  (2)

Insert a layer at the end of a chain:

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

Insert a named layer in the middle of a chain:

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

Possible Issues  (1)

See Also

NetDelete  NetTake  NetDrop  NetExtract  NetFlatten  NetReplace  NetReplacePart  NetRename  NetAppend  NetPrepend  NetChain

Tutorials

Introduced in 2018
(11.3)