ClikaRT::NamedTensors
class
Header: ClikaRT/compute/named_tensors.h
A name → Tensor collection: the container for a model's weights / state-dict and for multi-tensor I/O (safetensors, gguf). Entries are Tensors (shared refcount handles), so set/get are cheap and the map shares each tensor's storage rather than copying data.
An insertion-agnostic name → Tensor map. Copyable and movable (a copy shares each entry's storage; the tensors are refcount handles).
Member functions
NamedTensors()
NamedTensors()
An empty collection.
Declared in ClikaRT/compute/named_tensors.h, line 31
NamedTensors(NamedTensors)
NamedTensors(const NamedTensors& other)
Copy: an independent map; the tensor VALUES stay shared handles (storage is not duplicated).
Declared in ClikaRT/compute/named_tensors.h, line 35
operator=(NamedTensors)
NamedTensors& operator=(const NamedTensors& other)
Copy-assign; same handle-sharing semantics as the copy ctor.
Declared in ClikaRT/compute/named_tensors.h, line 37
NamedTensors(NamedTensors)
NamedTensors(NamedTensors&& other) noexcept
Move: transfers the map; other is left empty.
Declared in ClikaRT/compute/named_tensors.h, line 39
operator=(NamedTensors)
NamedTensors& operator=(NamedTensors&& other) noexcept
Move-assign; transfers the map.
Declared in ClikaRT/compute/named_tensors.h, line 41
~NamedTensors()
~NamedTensors()
Releases the map (each held handle drops its reference).
Declared in ClikaRT/compute/named_tensors.h, line 43
set()
void set(std::string_view name, Tensor tensor)
Insert or replace the tensor under name. name is copied.
Declared in ClikaRT/compute/named_tensors.h, line 46
get()
Tensor get(std::string_view name) const
The tensor under name; raises ClikaRT::Error (NotFound) if absent.
Declared in ClikaRT/compute/named_tensors.h, line 49
contains()
bool contains(std::string_view name) const
True if name is present.
Declared in ClikaRT/compute/named_tensors.h, line 51
size()
std::size_t size() const
Number of entries.
Declared in ClikaRT/compute/named_tensors.h, line 53
names()
std::vector<std::string> names() const
All entry names (unordered).
Declared in ClikaRT/compute/named_tensors.h, line 55
for_each()
void for_each(const std::function<void(std::string_view name, const Tensor&tensor)>& visit) const
Visit each entry. name and tensor are valid only during the call.
A throw from visit is contained HERE, in your own TU / runtime, never unwinding through the library frame (a cross-runtime unwind into the Release .so's static C++ runtime terminates), and stops the walk, and surfaces as the raised ClikaRT::Error / returned failure. To stop the walk early WITHOUT an error, use for_each_while.
Declared in ClikaRT/compute/named_tensors.h, line 63
for_each_while()
void for_each_while(
const std::function<bool(std::string_view name, const Tensor&tensor)>& visit
) const
The abort-capable sibling: visit returns false to stop the walk early (a clean stop, not an error). A throw is contained exactly as in for_each.
Declared in ClikaRT/compute/named_tensors.h, line 73