---
title: "ClikaRT::ops::leaky_relu"
sidebar_label: "leaky_relu"
description: "ReLU with a small slope on the negative side. \\[ \\mathrm{leaky\\_relu}(x) = \\begin{cases} x & x > 0 \\\\ \\mathrm{negative\\_slope}\\cdot x & x \\le 0 \\end{cases} \\] input the input tensor."
---

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

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

## leaky\_relu() {#leaky_relu}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`leaky_relu`**([`Tensor`](../Tensor.md) `input`, `double` `negative_slope` `=` `0.01`)

</div>

ReLU with a small slope on the negative side.

$$
\mathrm{leaky\_relu}(x) = \begin{cases} x & x > 0 \\ \mathrm{negative\_slope}\cdot x & x \le 0 \end{cases}
$$

**Parameters**

- `input`: the input tensor.
- `negative_slope`: the negative-side slope. Default `0.01`.

**Throws**

- `ClikaRT::Error`: when the input's dtype is not served for this operation (the machine-readable reason rides `code_name()`).

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

```cpp
auto y = ClikaRT::ops::leaky_relu(x, 0.2);
```

<div class="api-declared">

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

</div>
