---
title: "ClikaRT::ops::prelu"
sidebar_label: "prelu"
description: "Parametric ReLU: a learned negative-side slope. \\[ \\mathrm{prelu}(x) = \\begin{cases} x & x > 0 \\\\ w \\cdot x & x \\le 0 \\end{cases} \\] weight is a scalar or a per-channel tensor broadcast against input.…"
---

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

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

## prelu() {#prelu}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`prelu`**([`Tensor`](../Tensor.md) `input`, [`OptionalTensor`](../../index.md#OptionalTensor) `weight` `=` `{}`)

</div>

Parametric ReLU: a learned negative-side slope.

$$
\mathrm{prelu}(x) = \begin{cases} x & x > 0 \\ w \cdot x & x \le 0 \end{cases}
$$

`weight` is a scalar or a per-channel tensor broadcast against `input`.

**Parameters**

- `input`: the input tensor.
- `weight`: the negative-slope tensor (scalar or per-channel). Absent uses the weight held by the bound primitive (module usage).

**Throws**

- `ClikaRT::Error`: when `weight`'s shape does not broadcast against `input`, or when the dtype is not served (`code_name()` carries the reason).

**Returns:** a new tensor, same shape and dtype as `input`.

```cpp
auto y = ClikaRT::ops::prelu(x, slopes);   // slopes: [C] or scalar
```

<div class="api-declared">

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

</div>
