represents a net layer taking a list of input arrays and performing elementwise addition on them.

Details and Options

  • TotalLayer is typically used inside NetGraph.
  • Option InputPorts can be used to specify the number, names or shapes of input ports. If InputPorts is not specified, the number of ports and their shapes are inferred from NetChain or NetGraph connectivity.
  • Besides input ports, TotalLayer exposes the following port for use in NetGraph etc.:
  • "Output"an array
  • Within a NetGraph, a TotalLayer can be connected using a single edge of the form {src1,src2,}totlayer, where totlayer is the name or index of the TotalLayer, or as multiple separate edges given in the corresponding order, as src1totlayer,src2totlayer,,srcntotlayer.
  • When it cannot be inferred from other layers in a larger net, the option "Output"{d1,d2,} can be used to fix the dimensions of the output of the TotalLayer. All inputs will also have their dimensions fixed to the same value.
  • TotalLayer[][{input1,input2,}] explicitly computes the output given a list of inputi. The output is effectively given by input1+input2+.
  • Options[TotalLayer] gives the list of default options to construct the layer. Options[TotalLayer[]] gives the list of default options to evaluate the layer on some data.
  • Information[TotalLayer[]] gives a report about the layer.
  • Information[TotalLayer[],prop] gives the value of the property prop of TotalLayer[]. Possible properties are the same as for NetGraph.


open allclose all

Basic Examples  (3)

Create a TotalLayer:

Create a TotalLayer with input dimension specified:

Apply the layer to a list of two vectors:

Construct a NetGraph with a TotalLayer that has two inputs:

Apply the layer to two vectors:

Scope  (2)

Create a TotalLayer that takes two matrices as input:

Create a TotalLayer that takes three real numbers as input, and apply it to a list:

Properties & Relations  (3)

TotalLayer computes:

Evaluate on some data:

TotalLayer[] is equivalent to ThreadingLayer[Plus]:

TotalLayer is similar to ConstantPlusLayer, except that ConstantPlusLayer adds a learned bias array to a single input, whereas TotalLayer performs elementwise addition of multiple inputs.

Possible Issues  (1)

TotalLayer cannot accept symbolic inputs:

Wolfram Research (2016), TotalLayer, Wolfram Language function, (updated 2018).


Wolfram Research (2016), TotalLayer, Wolfram Language function, (updated 2018).


@misc{reference.wolfram_2020_totallayer, author="Wolfram Research", title="{TotalLayer}", year="2018", howpublished="\url{}", note=[Accessed: 10-April-2021 ]}


@online{reference.wolfram_2020_totallayer, organization={Wolfram Research}, title={TotalLayer}, year={2018}, url={}, note=[Accessed: 10-April-2021 ]}


Wolfram Language. 2016. "TotalLayer." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2018.


Wolfram Language. (2016). TotalLayer. Wolfram Language & System Documentation Center. Retrieved from