<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/layers/merging/concatenate.py#L8-L163) |

Concatenates a list of inputs.

Inherits From: [`Layer`](https://www.tensorflow.org/api_docs/python/tf/keras/Layer), [`Operation`](https://www.tensorflow.org/api_docs/python/tf/keras/Operation)

    tf.keras.layers.Concatenate(
        axis=-1, **kwargs
    )

### Used in the notebooks

| Used in the guide | Used in the tutorials |
|---|---|
| - [Migrate \`tf.feature_column\`s to Keras preprocessing layers](https://www.tensorflow.org/guide/migrate/migrating_feature_columns) - [Migrate from TPU embedding_columns to TPUEmbedding layer](https://www.tensorflow.org/guide/migrate/tpu_embedding) | - [Load a pandas DataFrame](https://www.tensorflow.org/tutorials/load_data/pandas_dataframe) - [Load CSV data](https://www.tensorflow.org/tutorials/load_data/csv) - [pix2pix: Image-to-image translation with a conditional GAN](https://www.tensorflow.org/tutorials/generative/pix2pix) - [Image segmentation](https://www.tensorflow.org/tutorials/images/segmentation) - [Networks](https://www.tensorflow.org/agents/tutorials/8_networks_tutorial) |

It takes as input a list of tensors, all of the same shape except
for the concatenation axis, and returns a single tensor that is the
concatenation of all inputs.

#### Examples:

    x = np.arange(20).reshape(2, 2, 5)
    y = np.arange(20, 30).reshape(2, 1, 5)
    keras.layers.Concatenate(axis=1)([x, y])

Usage in a Keras model:

    x1 = keras.layers.Dense(8)(np.arange(10).reshape(5, 2))
    x2 = keras.layers.Dense(8)(np.arange(10, 20).reshape(5, 2))
    y = keras.layers.Concatenate()([x1, x2])

<br />

<br />

<br />

| ## Args ||
|---|---|
| `axis` | Axis along which to concatenate. |
| `**kwargs` | Standard layer keyword arguments. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A tensor, the concatenation of the inputs alongside axis `axis`. ||

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `input` | Retrieves the input tensor(s) of a symbolic operation. <br /> Only returns the tensor(s) corresponding to the *first time* the operation was called. |
| `output` | Retrieves the output tensor(s) of a layer. <br /> Only returns the tensor(s) corresponding to the *first time* the operation was called. |

<br />

## Methods

### `from_config`

[View source](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/ops/operation.py#L322-L362)

    @classmethod
    from_config(
        config
    )

Creates an operation from its config.

This method is the reverse of `get_config`, capable of instantiating the
same operation from the config dictionary.

> [!NOTE]
> **Note:** If you override this method, you might receive a serialized dtype config, which is a `dict`. You can deserialize it as follows:

    if "dtype" in config and isinstance(config["dtype"], dict):
        policy = dtype_policies.deserialize(config["dtype"])

<br />

<br />

<br />

| Args ||
|---|---|
| `config` | A Python dictionary, typically the output of `get_config`. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| An operation instance. ||

<br />