AggregationLayer

AggregationLayer[f]

represents a layer that aggregates an array of arbitrary rank into a vector, using the function f.

AggregationLayer[f,n]

aggregates an array at level n.

AggregationLayer[f,n1;;n2]

aggregates an array at levels n1 through n2.

AggregationLayer[f,{n1,n2,}]

aggregates an array at levels n1,n2,.

Details and Options

Examples

open allclose all

Basic Examples  (2)

Create an AggregationLayer using Max as the aggregation function:

Create an AggregationLayer that sums the elements of each row of a matrix:

Apply the layer to an input:

Scope  (5)

Create an AggregationLayer that finds the maximum value of an array:

Apply the layer to an input:

This is equivalent to:

Create an AggregationLayer that aggregates over the first, third and fourth dimensions of an input array:

Apply the layer to an input:

Create an AggregationLayer with the input size specified:

Apply the layer to an input:

Thread the layer across a batch of inputs:

Apply an AggregationLayer to aggregate over all the pixels in an image, returning the mean values for each color channel:

Apply an AggregationLayer to aggregate across color channels, turning a color image into a grayscale one:

Apply an AggregationLayer to aggregate over a varying dimension:

Properties & Relations  (1)

AggregationLayer[f,{n1,,nk}] is equivalent to:

Possible Issues  (1)

AggregationLayer cannot accept symbolic inputs:

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

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