Skip to main content

ClikaRT::io::AdaptCompose

struct

Header: ClikaRT/io/tensors_container.h

N source parts produce ONE adapted entry under to, the value view. The parts are CONSUMED (their names leave the adapted key space); to may equal one of the parts (the weight + weight_scaleweight shape).

transform runs LAZILY at materialization time (possibly mid load_state_dict), receiving the parts materialized per the container's load policy (already on the policy's device, unless host_parts places them on the host) and returning the produced tensor, which caches under to. It must be PURE over its inputs: capture no mutable state, never touch the container, and expect one invocation per materialization (an evicted composed value re-runs it on its next get). A throw from transform is contained at this boundary and surfaces as the materializing call's raised ClikaRT::Error.

Data members

from

std::vector<std::string> from

checkpoint-side names, concatenated in order

Declared in ClikaRT/io/tensors_container.h, line 203

to

std::string to

the single composed output name

Declared in ClikaRT/io/tensors_container.h, line 204

transform

std::function<Result<Tensor>(ClikaRT::Span<const Tensor>)> transform

Declared in ClikaRT/io/tensors_container.h, line 205

host_parts

bool host_parts = false

Materialize the parts on the HOST regardless of the load policy's device, for a transform that assembles bytes host-side (e.g. weaving a quantized blocks + scales pair into one packed payload). The raw parts then never upload (the assembly runs as plain host work instead of device ops), and the composed tensor caches as the transform returned it; a host-resident payload moves to its declared device when a module binds it, so the assembled bytes travel once. Affects parts placement only; leave unset to keep the policy placement.

Declared in ClikaRT/io/tensors_container.h, line 215