Mojo function

# mul

`mul(lhs: Symbol, rhs: Symbol, location: Optional[_SourceLocation] = #kgen.none) -> Symbol`

Computes the elementwise multiplication of two symbolic tensors.

Creates a new op node to compute the multiplication of two symbol tensor values and adds it to the graph, returning the symbolic result.

- If
`lhs`

and`rhs`

have different dtypes, they will be promoted according to the dtype promotion rules before the operation. - If
`lhs`

and`rhs`

have different shapes, they will be broadcast to the same shape according to broadcasting rules before the operation.

**Args:**

- β
**lhs**(`Symbol`

): The symbol to use as left side of the multiplication. - β
**rhs**(`Symbol`

): The symbol to use as right side of the multiplication. - β
**location**(`Optional[_SourceLocation]`

): An optional location for a more specific error message.

**Returns:**

A symbolic tensor value representing the output of the multiplication. The result will have: - the same dtype as the type-promotion of the two input dtypes - the same shape as the broadcast of the two input shapes.

**Raises:**

- If the input values' shapes are not compatible for broadcasting. See
`_elementwise_broadcast()`

for more. - If one of the input values has an unsupported dtype. - If the two symbols are parts of different graphs.

Was this page helpful?

Thank you! We'll create more content like this.

Thank you for helping us improve!

If you'd like to share more information, please report an issue on GitHub

π What went wrong?