represents a net layer that sums all of its input elements.
SummationLayer
represents a net layer that sums all of its input elements.
Details and Options
- SummationLayer[…][input] explicitly computes the output from applying the layer.
- SummationLayer[…][{input1,input2,…}] explicitly computes outputs for each of the inputi.
- SummationLayer exposes the following ports for use in NetGraph etc.:
-
"Input" an array of arbitrary rank "Output" a real number - SummationLayer is typically used inside NetChain, NetGraph, etc.
- When it cannot be inferred from other layers in a larger net, the option "Input"->{n1,n2,…} can be used to fix the input dimensions of SummationLayer.
- Options[SummationLayer] gives the list of default options to construct the layer. Options[SummationLayer[…]] gives the list of default options to evaluate the layer on some data.
- Information[SummationLayer[…]] gives a report about the layer.
- Information[SummationLayer[…],prop] gives the value of the property prop of SummationLayer[…]. Possible properties are the same as for NetGraph.
Examples
open all close allBasic Examples (2)
Create a SummationLayer:
SummationLayer[]Create a SummationLayer with vector input of size 4:
sum = SummationLayer["Input" -> {4}]sum[{1, 2, 3, -0.3}]Scope (1)
Ports (1)
Create a SummationLayer that takes an input array of dimensions 2×3×1:
sum = SummationLayer["Input" -> {2, 3, 1}]sum[RandomReal[1, {2, 3, 1}]]The layer threads across a batch of examples:
sum[RandomReal[1, {5, 2, 3, 1}]]Properties & Relations (2)
SummationLayer computes:
sum[data_] := Total[data, Infinity]data = {{{2.2, 3.4, 4}}};
SummationLayer[]@data
sum@dataSummationLayer[] is equivalent to AggregationLayer[Total,All]:
r = RandomReal[1, {5, 3, 2}];
SummationLayer[][r] === AggregationLayer[Total, All][r]Possible Issues (1)
SummationLayer cannot accept symbolic inputs:
sum = SummationLayer[];
sum[{1, 2}]sum[{1, z}]See Also
Tech Notes
Related Guides
History
Text
Wolfram Research (2016), SummationLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/SummationLayer.html.
CMS
Wolfram Language. 2016. "SummationLayer." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SummationLayer.html.
APA
Wolfram Language. (2016). SummationLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SummationLayer.html
BibTeX
@misc{reference.wolfram_2026_summationlayer, author="Wolfram Research", title="{SummationLayer}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/SummationLayer.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_summationlayer, organization={Wolfram Research}, title={SummationLayer}, year={2016}, url={https://reference.wolfram.com/language/ref/SummationLayer.html}, note=[Accessed: 13-June-2026]}