NetMapThreadOperator

NetMapThreadOperator[mapnet]

represents a net in which mapnet is mapped over one or more inputs to give one or more outputs.

NetMapThreadOperator[mapnet,n]

represents a net in which mapnet is mapped over its inputs at depth n.

NetMapThreadOperator[mapnet,"input1"n1,"input2"n2,]

represents a net in which mapnet is mapped over the input named inputi at depth ni, and all other inputs are replicated.

Details and Options

  • 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.
  • NetMapThreadOperator[mapnet] effectively maps mapnet simultaneously over the first level of each of its inputs. These inputs must have the same length.
  • NetMapThreadOperator[mapnet] is equivalent to NetMapThreadOperator[mapnet,1].
  • 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, NetMapThreadOperator[mapnet,n] takes an input of rank n+i and produces an output of rank n+o.
  • NetMapThreadOperator[mapnet,{"input1"n1,,"inputk"nk}] effectively maps mapnet at level n=Max[{n1,,nk}] by replicating those inputs with ni<n as appropriate.
  • Specifying "inputi"->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.
  • 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.
  • NetExtract can be used to extract mapnet from a NetMapThreadOperator[mapnet] object.
  • NetMapThreadOperator[net,"inputi"shape] allows the shape of the individual inputs to be specified. Possible forms for shape are:
  • da 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 remaining dimensions are d2×d3×
  • The following training parameter can be included:
  • LearningRateMultipliersAutomaticlearning rate multipliers for trainable arrays in the net
  • NetExtract allows access to the forward and reverse nets via "Net".
  • Options[NetMapThreadOperator] gives the list of default options to construct the operator. Options[NetMapThreadOperator[]] gives the list of default options to evaluate the operator on some data.
  • Information[NetMapThreadOperator[]] gives a report about the operator.
  • Information[NetMapThreadOperator[],prop] gives the value of the property prop of NetMapThreadOperator[]. Possible properties are the same as for NetGraph.

Examples

Basic Examples  (3)

Map a MeanAbsoluteLossLayer over corresponding inputs and targets to produce a vector of losses:

Map a MeanAbsoluteLossLayer at level 2 of input and target matrices to produce a result matrix:

Map a MeanAbsoluteLossLayer at level 1 of the input vector only, replicating the target vector:

Wolfram Research (2019), NetMapThreadOperator, Wolfram Language function, https://reference.wolfram.com/language/ref/NetMapThreadOperator.html (updated 2020).

Text

Wolfram Research (2019), NetMapThreadOperator, Wolfram Language function, https://reference.wolfram.com/language/ref/NetMapThreadOperator.html (updated 2020).

CMS

Wolfram Language. 2019. "NetMapThreadOperator." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/NetMapThreadOperator.html.

APA

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

BibTeX

@misc{reference.wolfram_2023_netmapthreadoperator, author="Wolfram Research", title="{NetMapThreadOperator}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/NetMapThreadOperator.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_netmapthreadoperator, organization={Wolfram Research}, title={NetMapThreadOperator}, year={2020}, url={https://reference.wolfram.com/language/ref/NetMapThreadOperator.html}, note=[Accessed: 19-March-2024 ]}