---
title: "ClikaRT::nn::fused"
sidebar_label: "fused"
description: "Namespace ClikaRT::nn::fused"
---

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

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

## Functions

### fuse\_linears() {#fuse_linears}

<div class="api-signature">

`std::shared_ptr<`[`Linear`](../Linear.md)`>` **`fuse_linears`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../../Span.md)`<const std::shared_ptr<`[`Linear`](../Linear.md)`>>` `parts`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`LinearOptions`](../LinearOptions.md) `options` `=` `{}`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/nn/fused.h`, line 85

</div>

### fuse\_convs() {#fuse_convs}

<div class="api-signature">

`std::shared_ptr<`[`Conv`](../Conv.md)`>` **`fuse_convs`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../../Span.md)`<const std::shared_ptr<`[`Conv`](../Conv.md)`>>` `parts`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<`[`ops::Activation`](../../ops/index.md#Activation)`>` `activation` `=` `std::nullopt`<br />
)

</div>

<div class="api-declared">

Declared in `ClikaRT/nn/fused.h`, line 126

</div>

## `ClikaRT/nn/fused.h` {#fused-h}

```cpp
#include <ClikaRT/nn/fused.h>
```

[`ClikaRT::nn::fused::fuse_linears`](./index.md#fuse_linears): sibling `Linear` projections (a QKV group, a gate‖up pair) collapse into ONE `Linear` that serves the concatenated projection. [`ClikaRT::nn::fused::fuse_convs`](./index.md#fuse_convs) does the same for sibling `Conv` layers over one input, concatenating along the output channels. The parts keep their names, their weights and their biases: each consumed part still lists its `weight`, read back from the group's fused weight as its own row band, and its `bias`, read back as its band of the group's bias, so a fused model's `named_parameters()` / `state_dict()` stay total under the parts' own names while the group owns the subset's single resident copy. The parts' raw weights and biases release inside the fuse itself, no forward needed: the group is the one resident copy from the moment `fuse_linears` returns. A `fuse_linears` group serves at its parts' residency when they agree (a load's `LoadOptions::weight_residency` stamps them alike) and `Packed` when they differ. A `PerCall` group keeps the joined weight as its one copy and packs nothing.
