---
title: "ClikaRT::ops::ssd_update"
sidebar_label: "ssd_update"
description: "Mamba2 / SSD selective-state serving step over a per-sequence [H, dim, dstate] Float32 state (updated IN PLACE; the returned tensor is out [B, T, H, dim], dtype following input)."
---

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

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

## ssd\_update() {#ssd_update}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`ssd_update`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `dt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `a_rate`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `b_mat`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `c_mat`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`OptionalTensor`](../../index.md#OptionalTensor) `d_skip`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`OptionalTensor`](../../index.md#OptionalTensor) `dt_bias`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`OptionalTensor`](../../index.md#OptionalTensor) `gate`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `state`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`OptionalTensor`](../../index.md#OptionalTensor) `seq_lens` `=` `{}`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`OptionalTensor`](../../index.md#OptionalTensor) `slot_ids` `=` `{}`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`bool` `dt_softplus` `=` `false`<br />
)

</div>

Mamba2 / SSD selective-state serving step over a per-sequence `[H, dim, dstate]` Float32 state (updated IN PLACE; the returned tensor is `out [B, T, H, dim]`, dtype following `input`). Per token: the state decays by [`exp`](./exp.md#exp)`(dt'*A[h])` (dt' = [`softplus`](./softplus.md#softplus)`(dt + dt_bias[h])` when `dt_softplus`), accumulates `dt'*(x (`[`outer`](./outer.md#outer)`) B)`, and emits `S*C + D[h]*x` (optionally silu-gated by `gate`). `A`/`D`/`dt_bias` are per-head Float32 parameters (`A` carries the NEGATIVE decay rate; fold `-exp(A_log)` at bind); `B`/`C` are `[B, T, G, dstate]` with `H % G == 0`. Decode is `T == 1`; a prefill runs the same sequential law. `seq_lens` (`[B]` Int32) bounds ragged rows. `slot_ids` (`[B]` Int32, device-resident) addresses `state` as a SLAB `[num_slots, H, dim, dstate]`: batch row `b` reads/updates slab row `slot_ids[b]` in place (ids in range and DISTINCT per call, the caller's contract); absent keeps state row `b`.

<div class="api-declared">

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

</div>
