---
title: "ClikaRT::ops::softplus"
sidebar_label: "softplus"
description: "Smooth ReLU. \\[ \\mathrm{softplus}(x) = \\tfrac{1}{\\beta}\\,\\log\\!\\bigl(1 + e^{\\beta x}\\bigr) \\] For numerical stability the exact linear input is returned where beta * x > threshold."
---

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

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

## softplus() {#softplus}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`softplus`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`double` `beta` `=` `1.0`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`double` `threshold` `=` `20.0`<br />
)

</div>

Smooth ReLU.

$$
\mathrm{softplus}(x) = \tfrac{1}{\beta}\,\log\!\bigl(1 + e^{\beta x}\bigr)
$$

For numerical stability the exact linear `input` is returned where `beta * x > `[`threshold`](./threshold.md#threshold).

**Parameters**

- `input`: the input tensor.
- `beta`: the sharpness; larger approaches ReLU. Default `1.0`.
- `threshold`: the linear-fallback switch point on `beta * x`. Default `20.0`.

**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::softplus(x);
```

<div class="api-declared">

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

</div>
