represents a net in which net is mapped over a sequence of inputs to give a sequence of outputs.

Details and Options

  • NetMapOperator[net] represents a net that takes a sequence of tensors and outputs a sequence of the same length.
  • NetMapOperator[net] accepts a single input sequence {x1,x2,,xn} and computes {net[x1],net[x2],,net[xn]}.
  • In NetMapOperator[net], net should take exactly one input and produce exactly one output.
  • NetExtract can be used to extract net from a NetMapOperator[net] object.
  • The input and output ports of the net represented by NetMapOperator are:
  • "Input"a sequence of tensors
    "Output"a sequence of tensors
  • NetMapOperator[net] can be seen as allowing a form of weight sharing between multiple copies of net, one for each sequence element that is being mapped.
  • NetMapOperator[net,"Input"->shape] allows the shape of the input to be specified. Possible forms for shape are:
  • NetEncoder[]encoder producing a sequence of vectors
    {len,p}sequence of len length-p vectors
    {len,Automatic}sequence of len vectors whose length is inferred
    {"Varying",p}varying number of vectors each of length p
    {"Varying",Automatic}varying number of vectors each of inferred length
    {lenspec,d1,d2,}sequence of tensors of dimensions d1×d2×


open allclose all

Basic Examples  (2)

Create a NetMapOperator that maps a LinearLayer over a sequence:

Click for copyable input

Create a NetMapOperator that maps a SummationLayer over a sequence:

Click for copyable input

Apply the layer to a sequence of vectors:

Click for copyable input

The layer threads across a batch of sequences of different lengths:

Click for copyable input

Scope  (3)

Applications  (1)

Properties & Relations  (1)

See Also

Fold  NetNestOperator  NetFoldOperator  NetPairEmbeddingOperator  NetChain  NetGraph  NetExtract

Introduced in 2017