Skip to main content

ClikaRT::nn::fused

namespace

Functions​

fuse_linears()​

std::shared_ptr<Linear> fuse_linears(
    ClikaRT::Span<const std::shared_ptr<Linear>> parts,
    LinearOptions options = {}
)

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

fuse_convs()​

std::shared_ptr<Conv> fuse_convs(
    ClikaRT::Span<const std::shared_ptr<Conv>> parts,
    std::optional<ops::Activation> activation = std::nullopt
)

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

ClikaRT/nn/fused.h​

#include <ClikaRT/nn/fused.h>

ClikaRT::nn::fused::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 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.