# tf.keras.layers.Concatenate

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v2.13.1/keras/layers/merging/concatenate.py#L28-L196) |

Layer that concatenates a list of inputs.

Inherits From: [`Layer`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/keras/layers/Layer), [`Module`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/Module)

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

\`tf.compat.v1.keras.layers.Concatenate\`

<br />

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

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.

    x = np.arange(20).reshape(2, 2, 5)
    print(x)
    [[[ 0  1  2  3  4]
      [ 5  6  7  8  9]]
     [[10 11 12 13 14]
      [15 16 17 18 19]]]
    y = np.arange(20, 30).reshape(2, 1, 5)
    print(y)
    [[[20 21 22 23 24]]
     [[25 26 27 28 29]]]
    tf.keras.layers.Concatenate(axis=1)([x, y])
    <tf.Tensor: shape=(2, 3, 5), dtype=int64, numpy=
    array([[[ 0,  1,  2,  3,  4],
            [ 5,  6,  7,  8,  9],
            [20, 21, 22, 23, 24]],
           [[10, 11, 12, 13, 14],
            [15, 16, 17, 18, 19],
            [25, 26, 27, 28, 29]]])>

    x1 = tf.keras.layers.Dense(8)(np.arange(10).reshape(5, 2))
    x2 = tf.keras.layers.Dense(8)(np.arange(10, 20).reshape(5, 2))
    concatted = tf.keras.layers.Concatenate()([x1, x2])
    concatted.shape
    TensorShape([5, 16])

<br />

<br />

<br />

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

<br />