Main Content

globalAveragePooling1dLayer

1-D global average pooling layer

    Description

    A 1-D global average pooling layer performs downsampling by outputting the average of the time or spatial dimensions of the input.

    The dimension that the layer pools over depends on the layer input:

    • For time series and vector sequence input (data with three dimensions corresponding to the channels, observations, and time steps), the layer pools over the time dimension.

    • For 1-D image input (data with three dimensions corresponding to the spatial pixels, channels, and observations), the layer pools over the spatial dimension.

    • For 1-D image sequence input (data with four dimensions corresponding to the spatial pixels, channels, observations, and time steps), the layer pools over the spatial dimension.

    Creation

    Description

    example

    layer = globalAveragePooling1dLayer creates a 1-D global average pooling layer.

    layer = globalAveragePooling1dLayer(Name=name) sets the optional Name property.

    Properties

    expand all

    Layer name, specified as a character vector or a string scalar. For Layer array input, the trainNetwork, assembleNetwork, layerGraph, and dlnetwork functions automatically assign names to layers with Name set to ''.

    Data Types: char | string

    This property is read-only.

    Number of inputs of the layer. This layer accepts a single input only.

    Data Types: double

    This property is read-only.

    Input names of the layer. This layer accepts a single input only.

    Data Types: cell

    This property is read-only.

    Number of outputs of the layer. This layer has a single output only.

    Data Types: double

    This property is read-only.

    Output names of the layer. This layer has a single output only.

    Data Types: cell

    Examples

    collapse all

    Create a 1-D global average pooling layer.

    layer = globalMaxPooling1dLayer
    layer = 
      GlobalMaxPooling1DLayer with properties:
    
        Name: ''
    
    

    Include a 1-D global average pooling layer in a layer array.

    layers = [
        sequenceInputLayer(12)
        convolution1dLayer(11,96)
        reluLayer
        globalAveragePooling1dLayer
        fullyConnectedLayer(10)
        softmaxLayer
        classificationLayer]
    layers = 
      7x1 Layer array with layers:
    
         1   ''   Sequence Input               Sequence input with 12 dimensions
         2   ''   Convolution                  96 11 convolutions with stride 1 and padding [0  0]
         3   ''   ReLU                         ReLU
         4   ''   1-D Global Average Pooling   1-D global average pooling
         5   ''   Fully Connected              10 fully connected layer
         6   ''   Softmax                      softmax
         7   ''   Classification Output        crossentropyex
    

    Algorithms

    expand all

    Introduced in R2021b