Exercise

# Performing element-wise multiplication

Element-wise multiplication in TensorFlow is performed using two tensors with identical shapes. This is because the operation multiplies elements in corresponding positions in the two tensors. An example of an element-wise multiplication, denoted by the \(\odot\) symbol, is shown below:

\(\begin{bmatrix} 1 & 2 \\ 2 & 1 \end{bmatrix} \odot \begin{bmatrix} 3 & 1 \\ 2 & 5 \end{bmatrix} = \begin{bmatrix} 3 & 2 \\ 4 & 5 \end{bmatrix}\)

In this exercise, you will perform element-wise multiplication, paying careful attention to the shape of the tensors you multiply. Note that `multiply()`

, `constant()`

, and `ones_like()`

have been imported for you.

Instructions

**100 XP**

- Define the tensors
`A1`

and`A23`

as constants. - Set
`B1`

to be a tensor of ones with the same shape as`A1`

. - Set
`B23`

to be a tensor of ones with the same shape as`A23`

. - Set
`C1`

and`C23`

equal to the element-wise products of`A1`

and`B1`

, and`A23`

and`B23`

, respectively.