NetMapOperatorCopy to clipboard.
✖
NetMapOperator
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 arrays 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 arrays "Output" a sequence of arrays - 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:
-
d a vector of size d {d1,d2} a matrix of size d1×d2 {d1,d2,…} an array of shape d1×d2×… {"Varying",d2,d3,…} an array whose first dimension is variable and whose remaining dimensions are d2×d3×… - The following training parameter can be included:
-
LearningRateMultipliers Automatic learning rate multipliers for trainable arrays in the net - NetExtract allows access to the forward and reverse nets via "Net".
- Options[NetMapOperator] gives the list of default options to construct the operator. Options[NetMapOperator[…]] gives the list of default options to evaluate the operator on some data.
- Information[NetMapOperator[…]] gives a report about the operator.
- Information[NetMapOperator[…],prop] gives the value of the property prop of NetMapOperator[…]. Possible properties are the same as for NetGraph.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Create a NetMapOperator that maps a LinearLayer over a sequence:

https://wolfram.com/xid/0mlfp1z4bl62-4ajk52

Create a NetMapOperator that maps a SummationLayer over a sequence:

https://wolfram.com/xid/0mlfp1z4bl62-psrddh

Apply the layer to a sequence of vectors:

https://wolfram.com/xid/0mlfp1z4bl62-8umgqw

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

https://wolfram.com/xid/0mlfp1z4bl62-q95cbk

Scope (3)Survey of the scope of standard use cases
Create a net that maps a LinearLayer over a sequence of vectors that have been one-hot encoded from the characters of a string:

https://wolfram.com/xid/0mlfp1z4bl62-9rvweb


https://wolfram.com/xid/0mlfp1z4bl62-xf04e1


https://wolfram.com/xid/0mlfp1z4bl62-dzt3pz

The initialized LinearLayer can be obtained using NetExtract:

https://wolfram.com/xid/0mlfp1z4bl62-55h8cy

Create a net that maps a single pooling layer over a pair of images. First create a pooling layer that operates on images:

https://wolfram.com/xid/0mlfp1z4bl62-11mbqp


https://wolfram.com/xid/0mlfp1z4bl62-i15e5b

Create a net that maps the pooling layer over sequences of images:

https://wolfram.com/xid/0mlfp1z4bl62-d9f3wn


https://wolfram.com/xid/0mlfp1z4bl62-mhn9fy

Use NetMapOperator to apply a one-dimensional pooling to each row of an image:

https://wolfram.com/xid/0mlfp1z4bl62-454xib


https://wolfram.com/xid/0mlfp1z4bl62-5xkdt2

Applications (1)Sample problems that can be solved with this function
Sorting lists of numbers. Generate a test and training set consisting of lists of integers between 1 and 6:

https://wolfram.com/xid/0mlfp1z4bl62-njdc95
Display three random samples drawn from the training set:

https://wolfram.com/xid/0mlfp1z4bl62-qfv88q

Define a NetGraph with an AttentionLayer:

https://wolfram.com/xid/0mlfp1z4bl62-wvkti7


https://wolfram.com/xid/0mlfp1z4bl62-kwgxp9

Use the net to sort a list of integers:

https://wolfram.com/xid/0mlfp1z4bl62-zm2ga9

Properties & Relations (1)Properties of the function, and connections to other functions
NetMapOperator can be used to implement NetPairEmbeddingOperator. Create an initialized LinearLayer:

https://wolfram.com/xid/0mlfp1z4bl62-4a82u2

Create NetPairEmbeddingOperator using the linear layer as its embedding net, and evaluate it on an input:

https://wolfram.com/xid/0mlfp1z4bl62-hfdlob


https://wolfram.com/xid/0mlfp1z4bl62-iiunif

Define a NetGraph with a NetMapOperator that is equivalent to the previous NetPairEmbeddingOperator, and evaluate it on the same input:

https://wolfram.com/xid/0mlfp1z4bl62-9lffv5


https://wolfram.com/xid/0mlfp1z4bl62-pg1cnj

Wolfram Research (2017), NetMapOperator, Wolfram Language function, https://reference.wolfram.com/language/ref/NetMapOperator.html (updated 2020).
Text
Wolfram Research (2017), NetMapOperator, Wolfram Language function, https://reference.wolfram.com/language/ref/NetMapOperator.html (updated 2020).
Wolfram Research (2017), NetMapOperator, Wolfram Language function, https://reference.wolfram.com/language/ref/NetMapOperator.html (updated 2020).
CMS
Wolfram Language. 2017. "NetMapOperator." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/NetMapOperator.html.
Wolfram Language. 2017. "NetMapOperator." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/NetMapOperator.html.
APA
Wolfram Language. (2017). NetMapOperator. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NetMapOperator.html
Wolfram Language. (2017). NetMapOperator. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NetMapOperator.html
BibTeX
@misc{reference.wolfram_2025_netmapoperator, author="Wolfram Research", title="{NetMapOperator}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/NetMapOperator.html}", note=[Accessed: 06-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_netmapoperator, organization={Wolfram Research}, title={NetMapOperator}, year={2020}, url={https://reference.wolfram.com/language/ref/NetMapOperator.html}, note=[Accessed: 06-April-2025
]}