NetPrepend

NetPrepend[net,layer]

prepends a layer or a net onto a NetChain, a layer or a NetGraph with one input port.

NetPrepend[net,"name"layer]

appends a layer with a given name.

NetPrepend[net,{layer1,layer2,}]

prepends several layers or nets.

Details and Options

  • The output of the prepended layer must be compatible with the input of the first layer in the chain.
  • Any NetEncoder attached to the end of the chain will be removed.
  • NetPrepend[chain,layerspec,"Input"spec] can be used to specify a type for the input of the resulting chain, using the normal type specifications allowed by NetChain. The new port specification will replace any existing NetEncoder or type.

Examples

open allclose all

Basic Examples  (3)

Prepend a layer to the start of a chain:

Prepend a named layer to the start of a chain:

Prepend several layers to the start of a chain:

Scope  (3)

Prepend a layer and attach a NetEncoder:

Create a NetChain with NetPrepend:

Prepend a layer to a NetGraph with one input:

Prepend a layer with a given name:

Possible Issues  (3)

The output of the prepended layer must be compatible with the input of the first layer in the chain:

A network with several outputs cannot be prepended:

A layer cannot be prepended to a network with more than one input:

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

Text

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

CMS

Wolfram Language. 2018. "NetPrepend." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 13. https://reference.wolfram.com/language/ref/NetPrepend.html.

APA

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

BibTeX

@misc{reference.wolfram_2021_netprepend, author="Wolfram Research", title="{NetPrepend}", year="13", howpublished="\url{https://reference.wolfram.com/language/ref/NetPrepend.html}", note=[Accessed: 22-May-2022 ]}

BibLaTeX

@online{reference.wolfram_2021_netprepend, organization={Wolfram Research}, title={NetPrepend}, year={13}, url={https://reference.wolfram.com/language/ref/NetPrepend.html}, note=[Accessed: 22-May-2022 ]}