represents a net in which net is applied n times to the input.

Details and Options

  • NetFoldOperator[net,n] accepts a single input tensor s0 and produces an output tensor sn, computed by applying net repeatedly to si-1 to compute si .
  • In NetNestOperator[net,n], net should take exactly one input and produce exactly one output. The input and output must be of the same dimensions.
  • NetNestOperator exposes the following ports for use in NetGraph etc.:
  • "Input"the initial state s0
    "Output"the final state sn
  • If net contains trainable parameters, the same parameters are used for every application of net to the input.
  • If net has no trainable parameters, NetNestOperator[net,n] is equivalent to a NetChain containing n copies of net.


open allclose all

Basic Examples  (1)

Create a net that applies a LinearLayer 10 times:

Click for copyable input

Randomly initialize the net and apply it to an input:

Click for copyable input

Neat Examples  (1)

See Also

Nest  NetFoldOperator  NetMapOperator  NetChain  NetGraph

Introduced in 2017