---
title: "ClikaRT::ops::hardsigmoid"
sidebar_label: "hardsigmoid"
description: "Piecewise-linear sigmoid approximation. \\[ \\mathrm{hardsigmoid}(x) = \\mathrm{clamp}\\!\\bigl(\\tfrac{x}{6} + \\tfrac{1}{2},\\; 0,\\; 1\\bigr) \\] ClikaRT::Error when the input's dtype is not served for this o…"
---

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

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

## hardsigmoid() {#hardsigmoid}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`hardsigmoid`**([`Tensor`](../Tensor.md) `input`)

</div>

Piecewise-linear sigmoid approximation.

$$
\mathrm{hardsigmoid}(x) = \mathrm{clamp}\!\bigl(\tfrac{x}{6} + \tfrac{1}{2},\; 0,\; 1\bigr)
$$

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

<div class="api-declared">

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

</div>
