Main Content

globalMaxPooling1dLayer

1-D global max pooling layer

Since R2021b

    Description

    A 1-D global max pooling layer performs downsampling by outputting the maximum 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 "C" (channel), "B" (batch), and "T" (time) dimensions), the layer pools over the "T" (time) dimension.

    • For 1-D image input (data with three dimensions corresponding to the "S" (spatial), "C" (channel), and "B" (batch) dimensions), the layer pools over the "S" (spatial) dimension.

    • For 1-D image sequence input (data with four dimensions corresponding to the "S" (spatial), "C" (channel), "B" (batch), and "T" (time) dimensions), the layer pools over the "S" (spatial) dimension.

    Creation

    Description

    layer = globalMaxPooling1dLayer creates a 1-D global max pooling layer.

    example

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

    Properties

    expand all

    Layer name, specified as a character vector or string scalar. For Layer array input, the trainnet and dlnetwork functions automatically assign names to layers with the name "".

    The GlobalMaxPooling1DLayer object stores this property as a character vector.

    Data Types: char | string

    This property is read-only.

    Number of inputs to the layer, returned as 1. This layer accepts a single input only.

    Data Types: double

    This property is read-only.

    Input names, returned as {'in'}. This layer accepts a single input only.

    Data Types: cell

    This property is read-only.

    Number of outputs from the layer, returned as 1. This layer has a single output only.

    Data Types: double

    This property is read-only.

    Output names, returned as {'out'}. This layer has a single output only.

    Data Types: cell

    Examples

    collapse all

    Create a 1-D global max pooling layer.

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

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

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

    Algorithms

    expand all

    Extended Capabilities

    Version History

    Introduced in R2021b