---
title: "ClikaRT::ops::swiglu"
sidebar_label: "swiglu"
description: "SwiGLU over a concatenated [*, 2d] gate‖up input → [*, d], the clamped gated form: out = (clamp(up, ±limit) + beta) · G · sigmoid(alpha·G) with G = min(gate, limit)."
---

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

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

## swiglu() {#swiglu}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`swiglu`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`double` `alpha` `=` `1.0`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`double` `beta` `=` `0.0`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`double` `limit` `=` `std::numeric_limits<double>::infinity()`<br />
)

</div>

SwiGLU over a concatenated `[*, 2d]` gate‖up input → `[*, d]`, the clamped gated form: `out = (`[`clamp`](./clamp.md#clamp)`(up, ±limit) + beta) · G · `[`sigmoid`](./sigmoid.md#sigmoid)`(alpha·G)` with `G = min(gate, limit)`. The defaults reduce exactly to the plain `silu(gate) · up`. The last dim must be even.

<div class="api-declared">

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

</div>
