tf.keras.layers.GlobalAveragePooling1D
Stay organized with collections
Save and categorize content based on your preferences.
Global average pooling operation for temporal data.
tf.keras.layers.GlobalAveragePooling1D(
data_format='channels_last', **kwargs
)
Arguments |
data_format
|
A string,
one of channels_last (default) or channels_first .
The ordering of the dimensions in the inputs.
channels_last corresponds to inputs with shape
(batch, steps, features) while channels_first
corresponds to inputs with shape
(batch, features, steps) .
|
Call arguments:
inputs
: A 3D tensor.
mask
: Binary tensor of shape (batch_size, steps)
indicating whether
a given step should be masked (excluded from the average).
- If
data_format='channels_last'
:
3D tensor with shape:
(batch_size, steps, features)
- If
data_format='channels_first'
:
3D tensor with shape:
(batch_size, features, steps)
Output shape:
2D tensor with shape (batch_size, features)
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.keras.layers.GlobalAveragePooling1D\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 2 version](/api_docs/python/tf/keras/layers/GlobalAveragePooling1D) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/layers/pooling.py#L603-L651) |\n\nGlobal average pooling operation for temporal data.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tf.keras.layers.GlobalAvgPool1D`](/api_docs/python/tf/keras/layers/GlobalAveragePooling1D)\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.keras.layers.GlobalAveragePooling1D`](/api_docs/python/tf/keras/layers/GlobalAveragePooling1D), [`tf.compat.v1.keras.layers.GlobalAvgPool1D`](/api_docs/python/tf/keras/layers/GlobalAveragePooling1D), \\`tf.compat.v2.keras.layers.GlobalAveragePooling1D\\`, \\`tf.compat.v2.keras.layers.GlobalAvgPool1D\\`\n\n\u003cbr /\u003e\n\n tf.keras.layers.GlobalAveragePooling1D(\n data_format='channels_last', **kwargs\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Arguments --------- ||\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `data_format` | A string, one of `channels_last` (default) or `channels_first`. The ordering of the dimensions in the inputs. `channels_last` corresponds to inputs with shape `(batch, steps, features)` while `channels_first` corresponds to inputs with shape `(batch, features, steps)`. |\n\n\u003cbr /\u003e\n\n#### Call arguments:\n\n- **`inputs`**: A 3D tensor.\n- **`mask`** : Binary tensor of shape `(batch_size, steps)` indicating whether a given step should be masked (excluded from the average).\n\n#### Input shape:\n\n- If `data_format='channels_last'`: 3D tensor with shape: `(batch_size, steps, features)`\n- If `data_format='channels_first'`: 3D tensor with shape: `(batch_size, features, steps)`\n\n#### Output shape:\n\n2D tensor with shape `(batch_size, features)`."]]