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, height, width, channels) while channels_first corresponds to
inputs with shape (batch, channels, height, width).
Returns
Reshaped tensor.
Examples:
x=tf.compat.v1.placeholder(shape=(None,4,4),dtype='float32')y=flatten(x)# now `y` has shape `(None, 16)`x=tf.compat.v1.placeholder(shape=(None,3,None),dtype='float32')y=flatten(x)# now `y` has shape `(None, None)`
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.layers.flatten\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/layers/core.py#L300-L332) |\n\nFlattens an input tensor while preserving the batch axis (axis 0). (deprecated)\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.layers.flatten`](/api_docs/python/tf/compat/v1/layers/flatten)\n\n\u003cbr /\u003e\n\n tf.layers.flatten(\n inputs, name=None, data_format='channels_last'\n )\n\n| **Warning:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use keras.layers.flatten instead.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Arguments --------- ||\n|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `inputs` | Tensor input. |\n| `name` | The name of the layer (string). |\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, height, width, channels)` while `channels_first` corresponds to inputs with shape `(batch, channels, height, width)`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| Reshaped tensor. ||\n\n\u003cbr /\u003e\n\n#### Examples:\n\n x = tf.compat.v1.placeholder(shape=(None, 4, 4), dtype='float32')\n y = flatten(x)\n # now `y` has shape `(None, 16)`\n\n x = tf.compat.v1.placeholder(shape=(None, 3, None), dtype='float32')\n y = flatten(x)\n # now `y` has shape `(None, None)`"]]