---
title: "ClikaRT::ops::mul"
sidebar_label: "mul"
description: "Multiplies input by other elementwise. \\[ out = act(a \\cdot other) \\] Broadcasts and promotes as add; activation is the same fused float-only epilogue (default Activation::Identity)."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--function">function</span>

2 overloads.

## mul(Tensor, ScalarOrTensor, Activation) {#mul}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`mul`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ScalarOrTensor`](../ScalarOrTensor.md) `other`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Activation`](./index.md#Activation) `activation` `=` [`Activation::Identity`](./index.md#Activation)<br />
)

</div>

Multiplies `input` by `other` elementwise.

$$
out = act(a \cdot other)
$$

Broadcasts and promotes as [`add`](./add.md#add); `activation` is the same fused float-only epilogue (default [`Activation::Identity`](./index.md#Activation)).

**Returns:** the broadcast-shaped product at the promoted dtype.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when the operand shapes are not broadcast-compatible. Also raises (`INVALID_ARGUMENT`) for a non-float `activation` operand dtype.

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 1559

</div>

## mul(Scalar, Tensor, Activation) {#mul-2}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`mul`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Scalar`](../Scalar.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `other`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Activation`](./index.md#Activation) `activation` `=` [`Activation::Identity`](./index.md#Activation)<br />
)

</div>

Scalar-LHS $act(a \cdot b)$. `input` keeps its kind (see [`Scalar`](../Scalar.md)). `activation` applies to the result, mirroring the tensor-first form (mul carries no alpha; it would fold into the scalar).

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 1566

</div>
