({{, (RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[mapnet] 
represents a net in which mapnet is mapped over one or more inputs to give one or more outputs.}, {, (RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[mapnet,n]
represents a net in which mapnet is mapped over its inputs at depth n.}, {, (RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[mapnet,\[LeftAssociation]"(Subscript[input, 1])"->(Subscript[n, 1]),"(Subscript[input, 2])"->(Subscript[n, 2]),…\[RightAssociation]]
represents a net in which mapnet is mapped over the input named (Subscript[input, i]) at depth (Subscript[n, i]), and all other inputs are replicated.}})

OpenersNotesSection(Spacer1)Details

(RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[mapnet] represents a net that takes the same number of arrays as mapnet and produces the same number of arrays as mapnet, but repeatedly applies mapnet to corresponding elements of the inputs.

(RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[mapnet] effectively maps mapnet simultaneously over the first level of each of its inputs. These inputs must have the same length.

(RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[mapnet] is equivalent to (RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[mapnet,1].

(RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[mapnet,n] effectively applies mapnet at level n to its inputs, and hence expects n additional dimensions over the inputs and outputs of mapnet.

Therefore, if mapnet takes an input of rank i and produces an output of rank o, (RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[mapnet,n] takes an input of rank n+i and produces an output of rank n+o.

(RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[mapnet,{"(Subscript[input, 1])"->(Subscript[n, 1]),…,"(Subscript[input, k])"->(Subscript[n, k])}] effectively maps mapnet at level n=(RefLink[Max, paclet:ref/Max])[{(Subscript[n, 1]),…,(Subscript[n, k])}] by replicating those inputs with (Subscript[n, i])<n as appropriate.

Specifying "(Subscript[input, i])"->0 is equivalent to omitting the input from the level specification and means that the unmodified input is supplied to each mapped application of subnet unchanged.

(RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[net] can be seen as allowing a form of weight sharing between multiple copies of net, one for each element that is being mapped.

(RefLink[NetExtract, paclet:ref/NetExtract]) can be used to extract mapnet from a (RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[mapnet] object.

(RefLink[NetMapThreadOperator, paclet:ref/NetMapThreadOperator])[net,"(Subscript[input, i])"->shape] allows the shape of the individual inputs to be specified. Possible forms for shape are:

When given a (RefLink[NumericArray, paclet:ref/NumericArray]) as input, the output will be a (RefLink[NumericArray, paclet:ref/NumericArray]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Map a (RefLink[MeanAbsoluteLossLayer, paclet:ref/MeanAbsoluteLossLayer]) over corresponding inputs and targets to produce a vector of losses:

loss=MeanAbsoluteLossLayer["Input"->{},"Target"->{}]

op=NetMapThreadOperator[loss]

op[<|"Input"->{1,2,3,4},"Target"->{2,3,3,2}|>]

Map a (RefLink[MeanAbsoluteLossLayer, paclet:ref/MeanAbsoluteLossLayer]) at level 2 of input and target matrices to produce a result matrix:

loss=MeanAbsoluteLossLayer["Input"->{},"Target"->{}]

op=NetMapThreadOperator[loss,2,"Input"->{2,3}]

op[<|"Input"->{{1,2,3},{3,2,1}},"Target"->{{3,1,2},{2,2,1}}|>]

Map a (RefLink[MeanAbsoluteLossLayer, paclet:ref/MeanAbsoluteLossLayer]) at level 1 of the input vector only, replicating the target vector:

loss=MeanAbsoluteLossLayer["Input"->{},"Target"->{}]

op=NetMapThreadOperator[loss,<|"Input"->1|>,"Input"->{3},"Target"->{}]

op[<|"Input"->{1,2,3},"Target"->3|>]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[NetMapOperator, paclet:ref/NetMapOperator])  ▪  (RefLink[NetFoldOperator, paclet:ref/NetFoldOperator])  ▪  (RefLink[ReplicateLayer, paclet:ref/ReplicateLayer])  ▪  (RefLink[MapThread, paclet:ref/MapThread])  ▪  (RefLink[NetChain, paclet:ref/NetChain])  ▪  (RefLink[NetGraph, paclet:ref/NetGraph])  ▪  (RefLink[NetExtract, paclet:ref/NetExtract])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Neural Networks, paclet:guide/NeuralNetworks])}})}})