<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/ops/math_ops.py#L505-L554) |

Returns an element-wise x \* y.

#### View aliases


**Main aliases**

[`tf.multiply`](https://www.tensorflow.org/api_docs/python/tf/math/multiply)
**Compat aliases for migration**

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

[`tf.compat.v1.multiply`](https://www.tensorflow.org/api_docs/python/tf/math/multiply)

<br />

    tf.math.multiply(
        x, y, name=None
    )

### Used in the notebooks

| Used in the guide | Used in the tutorials |
|---|---|
| - [Introduction to Tensors](https://www.tensorflow.org/guide/tensor) - [Migrate the SavedModel workflow](https://www.tensorflow.org/guide/migrate/saved_model) - [Training \& evaluation with the built-in methods](https://www.tensorflow.org/guide/keras/training_with_built_in_methods) | - [Customization basics: tensors and operations](https://www.tensorflow.org/tutorials/customization/basics) - [Parametrized Quantum Circuits for Reinforcement Learning](https://www.tensorflow.org/quantum/tutorials/quantum_reinforcement_learning) - [Universal Sentence Encoder](https://www.tensorflow.org/hub/tutorials/semantic_similarity_with_tf_hub_universal_encoder) - [Universal Sentence Encoder-Lite demo](https://www.tensorflow.org/hub/tutorials/semantic_similarity_with_tf_hub_universal_encoder_lite) - [TFX Estimator Component Tutorial](https://www.tensorflow.org/tfx/tutorials/tfx/components) |

#### For example:

    x = tf.constant(([1, 2, 3, 4]))
    tf.math.multiply(x, x)
    <tf.Tensor: shape=(4,), dtype=..., numpy=array([ 1,  4,  9, 16], dtype=int32)>

Since [`tf.math.multiply`](https://www.tensorflow.org/api_docs/python/tf/math/multiply) will convert its arguments to `Tensor`s, you can also
pass in non-`Tensor` arguments:

    tf.math.multiply(7,6)
    <tf.Tensor: shape=(), dtype=int32, numpy=42>

If `x.shape` is not the same as `y.shape`, they will be broadcast to a
compatible shape. (More about broadcasting
[here](https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html).)

#### For example:

    x = tf.ones([1, 2]);
    y = tf.ones([2, 1]);
    x * y  # Taking advantage of operator overriding
    <tf.Tensor: shape=(2, 2), dtype=float32, numpy=
    array([[1., 1.],
         [1., 1.]], dtype=float32)>

The reduction version of this elementwise operation is [`tf.math.reduce_prod`](https://www.tensorflow.org/api_docs/python/tf/math/reduce_prod)

<br />

<br />

<br />

| ## Args ||
|---|---|
| `x` | A Tensor. Must be one of the following types: `bfloat16`, `half`, `float32`, `float64`, `uint8`, `int8`, `uint16`, `int16`, `int32`, `int64`, `complex64`, `complex128`. |
| `y` | A `Tensor`. Must have the same type as `x`. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|

<br />

A `Tensor`. Has the same type as `x`.

<br />

<br />

| ## Raises ||
|---|---|
| <br /> - InvalidArgumentError: When `x` and `y` have incompatible shapes or types. ||

<br />