[source]

MaxPooling1D

keras.layers.pooling.MaxPooling1D(pool_length=2, stride=None, border_mode='valid')

Max pooling operation for temporal data.

Input shape

3D tensor with shape: (samples, steps, features).

Output shape

3D tensor with shape: (samples, downsampled_steps, features).

Arguments

  • pool_length: size of the region to which max pooling is applied
  • stride: integer, or None. factor by which to downscale. 2 will halve the input. If None, it will default to pool_length.
  • border_mode: 'valid' or 'same'.

[source]

MaxPooling2D

keras.layers.pooling.MaxPooling2D(pool_size=(2, 2), strides=None, border_mode='valid', dim_ordering='default')

Max pooling operation for spatial data.

Arguments

  • pool_size: tuple of 2 integers, factors by which to downscale (vertical, horizontal). (2, 2) will halve the image in each dimension.
  • strides: tuple of 2 integers, or None. Strides values. If None, it will default to pool_size.
  • border_mode: 'valid' or 'same'.
  • dim_ordering: 'th' or 'tf'. In 'th' mode, the channels dimension (the depth) is at index 1, in 'tf' mode is it at index 3. It defaults to the image_dim_ordering value found in your Keras config file at ~/.keras/keras.json. If you never set it, then it will be "tf".

Input shape

4D tensor with shape: (samples, channels, rows, cols) if dim_ordering='th' or 4D tensor with shape: (samples, rows, cols, channels) if dim_ordering='tf'.

Output shape

4D tensor with shape: (nb_samples, channels, pooled_rows, pooled_cols) if dim_ordering='th' or 4D tensor with shape: (samples, pooled_rows, pooled_cols, channels) if dim_ordering='tf'.


[source]

MaxPooling3D

keras.layers.pooling.MaxPooling3D(pool_size=(2, 2, 2), strides=None, border_mode='valid', dim_ordering='default')

Max pooling operation for 3D data (spatial or spatio-temporal).

Arguments

  • pool_size: tuple of 3 integers, factors by which to downscale (dim1, dim2, dim3). (2, 2, 2) will halve the size of the 3D input in each dimension.
  • strides: tuple of 3 integers, or None. Strides values.
  • border_mode: 'valid' or 'same'.
  • dim_ordering: 'th' or 'tf'. In 'th' mode, the channels dimension (the depth) is at index 1, in 'tf' mode is it at index 4. It defaults to the image_dim_ordering value found in your Keras config file at ~/.keras/keras.json. If you never set it, then it will be "tf".

Input shape

5D tensor with shape: (samples, channels, len_pool_dim1, len_pool_dim2, len_pool_dim3) if dim_ordering='th' or 5D tensor with shape: (samples, len_pool_dim1, len_pool_dim2, len_pool_dim3, channels) if dim_ordering='tf'.

Output shape

5D tensor with shape: (nb_samples, channels, pooled_dim1, pooled_dim2, pooled_dim3) if dim_ordering='th' or 5D tensor with shape: (samples, pooled_dim1, pooled_dim2, pooled_dim3, channels) if dim_ordering='tf'.


[source]

AveragePooling1D

keras.layers.pooling.AveragePooling1D(pool_length=2, stride=None, border_mode='valid')

Average pooling for temporal data.

Arguments

  • pool_length: factor by which to downscale. 2 will halve the input.
  • stride: integer, or None. Stride value. If None, it will default to pool_length.
  • border_mode: 'valid' or 'same'.

Input shape

3D tensor with shape: (samples, steps, features).

Output shape

3D tensor with shape: (samples, downsampled_steps, features).


[source]

AveragePooling2D

keras.layers.pooling.AveragePooling2D(pool_size=(2, 2), strides=None, border_mode='valid', dim_ordering='default')

Average pooling operation for spatial data.

Arguments

  • pool_size: tuple of 2 integers, factors by which to downscale (vertical, horizontal). (2, 2) will halve the image in each dimension.
  • strides: tuple of 2 integers, or None. Strides values. If None, it will default to pool_size.
  • border_mode: 'valid' or 'same'.
  • dim_ordering: 'th' or 'tf'. In 'th' mode, the channels dimension (the depth) is at index 1, in 'tf' mode is it at index 3. It defaults to the image_dim_ordering value found in your Keras config file at ~/.keras/keras.json. If you never set it, then it will be "tf".

Input shape

4D tensor with shape: (samples, channels, rows, cols) if dim_ordering='th' or 4D tensor with shape: (samples, rows, cols, channels) if dim_ordering='tf'.

Output shape

4D tensor with shape: (nb_samples, channels, pooled_rows, pooled_cols) if dim_ordering='th' or 4D tensor with shape: (samples, pooled_rows, pooled_cols, channels) if dim_ordering='tf'.


[source]

AveragePooling3D

keras.layers.pooling.AveragePooling3D(pool_size=(2, 2, 2), strides=None, border_mode='valid', dim_ordering='default')

Average pooling operation for 3D data (spatial or spatio-temporal).

Arguments

  • pool_size: tuple of 3 integers, factors by which to downscale (dim1, dim2, dim3). (2, 2, 2) will halve the size of the 3D input in each dimension.
  • strides: tuple of 3 integers, or None. Strides values.
  • border_mode: 'valid' or 'same'.
  • dim_ordering: 'th' or 'tf'. In 'th' mode, the channels dimension (the depth) is at index 1, in 'tf' mode is it at index 4. It defaults to the image_dim_ordering value found in your Keras config file at ~/.keras/keras.json. If you never set it, then it will be "tf".

Input shape

5D tensor with shape: (samples, channels, len_pool_dim1, len_pool_dim2, len_pool_dim3) if dim_ordering='th' or 5D tensor with shape: (samples, len_pool_dim1, len_pool_dim2, len_pool_dim3, channels) if dim_ordering='tf'.

Output shape

5D tensor with shape: (nb_samples, channels, pooled_dim1, pooled_dim2, pooled_dim3) if dim_ordering='th' or 5D tensor with shape: (samples, pooled_dim1, pooled_dim2, pooled_dim3, channels) if dim_ordering='tf'.


[source]

GlobalMaxPooling1D

keras.layers.pooling.GlobalMaxPooling1D()

Global max pooling operation for temporal data.

Input shape

3D tensor with shape: (samples, steps, features).

Output shape

2D tensor with shape: (samples, features).


[source]

GlobalAveragePooling1D

keras.layers.pooling.GlobalAveragePooling1D()

Global average pooling operation for temporal data.

Input shape

3D tensor with shape: (samples, steps, features).

Output shape

2D tensor with shape: (samples, features).


[source]

GlobalMaxPooling2D

keras.layers.pooling.GlobalMaxPooling2D(dim_ordering='default')

Global max pooling operation for spatial data.

Arguments

  • dim_ordering: 'th' or 'tf'. In 'th' mode, the channels dimension (the depth) is at index 1, in 'tf' mode is it at index 3. It defaults to the image_dim_ordering value found in your Keras config file at ~/.keras/keras.json. If you never set it, then it will be "tf".

Input shape

4D tensor with shape: (samples, channels, rows, cols) if dim_ordering='th' or 4D tensor with shape: (samples, rows, cols, channels) if dim_ordering='tf'.

Output shape

2D tensor with shape: (nb_samples, channels)


[source]

GlobalAveragePooling2D

keras.layers.pooling.GlobalAveragePooling2D(dim_ordering='default')

Global average pooling operation for spatial data.

Arguments

  • dim_ordering: 'th' or 'tf'. In 'th' mode, the channels dimension (the depth) is at index 1, in 'tf' mode is it at index 3. It defaults to the image_dim_ordering value found in your Keras config file at ~/.keras/keras.json. If you never set it, then it will be "tf".

Input shape

4D tensor with shape: (samples, channels, rows, cols) if dim_ordering='th' or 4D tensor with shape: (samples, rows, cols, channels) if dim_ordering='tf'.

Output shape

2D tensor with shape: (nb_samples, channels)