# tf.keras.layers.Multiply

<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/multiply.py#L24-L51) |

Layer that multiplies (element-wise) 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.Multiply\`

<br />

    tf.keras.layers.Multiply(
        **kwargs
    )

It takes as input a list of tensors, all of the same shape, and returns
a single tensor (also of the same shape).

    tf.keras.layers.Multiply()([np.arange(5).reshape(5, 1),
                                np.arange(5, 10).reshape(5, 1)])
    <tf.Tensor: shape=(5, 1), dtype=int64, numpy=
    array([[ 0],
         [ 6],
         [14],
         [24],
         [36]])>

    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))
    multiplied = tf.keras.layers.Multiply()([x1, x2])
    multiplied.shape
    TensorShape([5, 8])

<br />

<br />

<br />

| ## Args ||
|---|---|
| `**kwargs` | standard layer keyword arguments. |

<br />