---
title: "ClikaRT::ops::fast_gelu"
sidebar_label: "fast_gelu"
description: "FastGELU: the tanh GELU approximation as a standalone op. \\[ \\mathrm{fast\\_gelu}(x) = \\tfrac{x}{2}\\Bigl(1 + \\tanh\\bigl(\\sqrt{2/\\pi}\\,(x + 0.044715\\,x^3)\\bigr)\\Bigr) \\] ClikaRT::Error when the input's…"
---

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

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

## fast\_gelu() {#fast_gelu}

<div class="api-signature">

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

</div>

FastGELU: the tanh GELU approximation as a standalone op.

$$
\mathrm{fast\_gelu}(x) = \tfrac{x}{2}\Bigl(1 + \tanh\bigl(\sqrt{2/\pi}\,(x + 0.044715\,x^3)\bigr)\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::fast_gelu(x);
```

<div class="api-declared">

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

</div>
