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:

Insert a named layer in the middle of a chain:

Possible Issues  (1)

When inserting a layer into a chain containing named layers, the key must not already exist:

Wolfram Research (2018), NetInsert, Wolfram Language function, https://reference.wolfram.com/language/ref/NetInsert.html.

Text

Wolfram Research (2018), NetInsert, Wolfram Language function, https://reference.wolfram.com/language/ref/NetInsert.html.

CMS

Wolfram Language. 2018. "NetInsert." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NetInsert.html.

APA

Wolfram Language. (2018). NetInsert. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NetInsert.html

BibTeX

@misc{reference.wolfram_2023_netinsert, author="Wolfram Research", title="{NetInsert}", year="2018", howpublished="\url{https://reference.wolfram.com/language/ref/NetInsert.html}", note=[Accessed: 28-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_netinsert, organization={Wolfram Research}, title={NetInsert}, year={2018}, url={https://reference.wolfram.com/language/ref/NetInsert.html}, note=[Accessed: 28-March-2024 ]}