Api: core
Api members outside every named family.
absent
fn absent(self) -> Tensor
An ABSENT tensor: the spelling for an optional tensor slot the
call leaves empty (a generated wrapper's bias / cache / mask
parameter). It carries no storage, works at both borrowed and
consumed positions, and dropping it is free.
clone_handle
fn clone_handle(self) -> Api
A second handle to the SAME loaded runtime: it shares the api table
and keeps the library mapped for its own lifetime. This is the
deliberate handle-copy spelling (Api implements no Clone, so a
copy is always visible at the call site). It is what a callback that
must build or read tensors after the registering borrow has ended
owns: let api_cb = api.clone_handle(); moved into the closure.
The tensor-payload callback typing
TensorCallback is Box<dyn for<'a> FnMut(Tensor<'a>) + Send>.
f_tensor_on_complete registers it together with a clone of the
registering handle; the generated thunk RETAINS the payload the
runtime borrows to the call, wraps it as a Tensor borrowing that
owned handle for the duration of the call, and passes it to the
closure BY VALUE. The closure's handle dropping releases the retained
reference (net zero), the runtime's own reference is never touched,
and Tensor<'a> stays a borrow type: the argument cannot outlive the
call, so a closure that needs the values past its return reads them
out inside the call (the typed readback fan, tensor_to_string).
The finalizer drops the closure and its owned handle together,
exactly once, when the runtime drops the registration. Spell the
closure's parameter type (move |result: Tensor<'_>| { .. }) so it
infers as higher-ranked.
device_cpu
fn device_cpu(self, i: i32) -> clika_rt_device
Wraps api-table member device_cpu.
ClikaRT::Device::cpu <- ClikaRT/compute/device.h
device_cuda
fn device_cuda(self, i: i32) -> clika_rt_device
Wraps api-table member device_cuda.
ClikaRT::Device::cuda <- ClikaRT/compute/device.h
device_gpu
fn device_gpu(self, index: i32) -> clika_rt_device
Wraps api-table member device_gpu.
ClikaRT::Device::gpu <- ClikaRT/compute/device.h
device_htp
fn device_htp(self, i: i32) -> clika_rt_device
Wraps api-table member device_htp.
ClikaRT::Device::htp <- ClikaRT/compute/device.h
device_is_cpu
fn device_is_cpu(self, self_: clika_rt_device) -> bool
Wraps api-table member device_is_cpu.
ClikaRT::Device::is_cpu <- ClikaRT/compute/device.h
device_is_cuda
fn device_is_cuda(self, self_: clika_rt_device) -> bool
Wraps api-table member device_is_cuda.
ClikaRT::Device::is_cuda <- ClikaRT/compute/device.h
device_is_htp
fn device_is_htp(self, self_: clika_rt_device) -> bool
Wraps api-table member device_is_htp.
ClikaRT::Device::is_htp <- ClikaRT/compute/device.h
device_is_metal
fn device_is_metal(self, self_: clika_rt_device) -> bool
Wraps api-table member device_is_metal.
ClikaRT::Device::is_metal <- ClikaRT/compute/device.h
device_is_tpu
fn device_is_tpu(self, self_: clika_rt_device) -> bool
Wraps api-table member device_is_tpu.
ClikaRT::Device::is_tpu <- ClikaRT/compute/device.h
device_is_vulkan
fn device_is_vulkan(self, self_: clika_rt_device) -> bool
Wraps api-table member device_is_vulkan.
ClikaRT::Device::is_vulkan <- ClikaRT/compute/device.h
device_metal
fn device_metal(self, i: i32) -> clika_rt_device
Wraps api-table member device_metal.
ClikaRT::Device::metal <- ClikaRT/compute/device.h
device_tpu
fn device_tpu(self, i: i32) -> clika_rt_device
Wraps api-table member device_tpu.
ClikaRT::Device::tpu <- ClikaRT/compute/device.h
device_vulkan
fn device_vulkan(self, i: i32) -> clika_rt_device
Wraps api-table member device_vulkan.
ClikaRT::Device::vulkan <- ClikaRT/compute/device.h
encode_audio / f_encode_audio
fn f_encode_audio(self, samples: &Tensor, sample_rate: i32) -> Result<Vec<u8>>
fn encode_audio(self, samples: &Tensor, sample_rate: i32) -> Vec<u8>
Wraps api-table member encode_audio.
ClikaRT::io::encode_audio <- ClikaRT/io/io.h
encode_image / f_encode_image
fn f_encode_image(self, image: &Tensor) -> Result<Vec<u8>>
fn encode_image(self, image: &Tensor) -> Vec<u8>
Wraps api-table member encode_image.
ClikaRT::io::encode_image <- ClikaRT/io/io.h
load
fn load(path: impl AsRef) -> Result<Self>
Load the runtime library and run the two-arm handshake: the runtime
must serve ABI_VERSION, and its api table must carry
LAYOUT_FINGERPRINT, the layout fingerprint this crate's generated
surface was emitted from.
load_audio_bytes / f_load_audio_bytes
fn f_load_audio_bytes(self, bytes: &[u8], target_sample_rate: i32, target_channels: i32) -> Result<(Tensor, clika_rt_audio_info)>
fn load_audio_bytes(self, bytes: &[u8], target_sample_rate: i32, target_channels: i32) -> (Tensor, clika_rt_audio_info)
Wraps api-table member load_audio_bytes.
ClikaRT::io::load_audio <- ClikaRT/io/io.h
load_audio_path / f_load_audio_path
fn f_load_audio_path(self, path: &str, target_sample_rate: i32, target_channels: i32) -> Result<(Tensor, clika_rt_audio_info)>
fn load_audio_path(self, path: &str, target_sample_rate: i32, target_channels: i32) -> (Tensor, clika_rt_audio_info)
Wraps api-table member load_audio_path.
ClikaRT::io::load_audio <- ClikaRT/io/io.h
load_gguf_to_gguf_checkpoint / f_load_gguf_to_gguf_checkpoint
fn f_load_gguf_to_gguf_checkpoint(self, path: &str, policy_device: clika_rt_stream_or_device, policy_sticky: bool) -> Result<GgufCheckpoint>
fn load_gguf_to_gguf_checkpoint(self, path: &str, policy_device: clika_rt_stream_or_device, policy_sticky: bool) -> GgufCheckpoint
Wraps api-table member load_gguf_to_gguf_checkpoint.
ClikaRT::io::load_gguf <- ClikaRT/io/io.h
load_image_bytes / f_load_image_bytes
fn f_load_image_bytes(self, bytes: &[u8], requested_channels: i32) -> Result<Tensor>
fn load_image_bytes(self, bytes: &[u8], requested_channels: i32) -> Tensor
Wraps api-table member load_image_bytes.
ClikaRT::io::load_image <- ClikaRT/io/io.h
load_image_path / f_load_image_path
fn f_load_image_path(self, path: &str, requested_channels: i32) -> Result<Tensor>
fn load_image_path(self, path: &str, requested_channels: i32) -> Tensor
Wraps api-table member load_image_path.
ClikaRT::io::load_image <- ClikaRT/io/io.h
load_npy / f_load_npy
fn f_load_npy(self, path: &str, device: clika_rt_device) -> Result<Tensor>
fn load_npy(self, path: &str, device: clika_rt_device) -> Tensor
Wraps api-table member load_npy.
ClikaRT::io::load_npy <- ClikaRT/io/io.h
load_safetensors_to_tensors_container / f_load_safetensors_to_tensors_container
fn f_load_safetensors_to_tensors_container(self, path: &str, policy_device: clika_rt_stream_or_device, policy_sticky: bool) -> Result<TensorsContainer>
fn load_safetensors_to_tensors_container(self, path: &str, policy_device: clika_rt_stream_or_device, policy_sticky: bool) -> TensorsContainer
Wraps api-table member load_safetensors_to_tensors_container.
ClikaRT::io::load_safetensors <- ClikaRT/io/io.h
load_torch_checkpoint_to_tensors_container / f_load_torch_checkpoint_to_tensors_container
fn f_load_torch_checkpoint_to_tensors_container(self, path: &str, policy_device: clika_rt_stream_or_device, policy_sticky: bool) -> Result<TensorsContainer>
fn load_torch_checkpoint_to_tensors_container(self, path: &str, policy_device: clika_rt_stream_or_device, policy_sticky: bool) -> TensorsContainer
Wraps api-table member load_torch_checkpoint_to_tensors_container.
ClikaRT::io::load_torch_checkpoint <- ClikaRT/io/io.h
load_with_abi
fn load_with_abi(path: impl AsRef, abi_version: u32) -> Result<Self>
Load with an explicit abi version and this crate's
LAYOUT_FINGERPRINT; NULL from the runtime (an unserved version)
refuses here, before the first call.
load_with_stamp
fn load_with_stamp(path: impl AsRef, abi_version: u32, layout_fingerprint: &str) -> Result<Self>
Load with an explicit abi version and an explicit expected layout
fingerprint. The runtime is refused with an Error whose status
is the UNSUPPORTED value, before any api-table slot is called, when
it does not serve abi_version, when its table's layout fingerprint
differs from the C header this crate compiled against, or when it
differs from layout_fingerprint. The message names the comparison
that failed and whether to rebuild or regenerate the bindings.
make_quantized / f_make_quantized
fn f_make_quantized(self, payload: Tensor, scheme: &str, logical_shape: &[i64], global_scale: Tensor) -> Result<QTensor>
fn make_quantized(self, payload: Tensor, scheme: &str, logical_shape: &[i64], global_scale: Tensor) -> QTensor
Wraps api-table member make_quantized.
ClikaRT::make_quantized <- ClikaRT/compute/q_tensor.h
make_quantized_affine / f_make_quantized_affine
fn f_make_quantized_affine(self, codes: Tensor, scales: Tensor, biases: Tensor, group_size: i64, bits: i64, logical_shape: &[i64]) -> Result<QTensor>
fn make_quantized_affine(self, codes: Tensor, scales: Tensor, biases: Tensor, group_size: i64, bits: i64, logical_shape: &[i64]) -> QTensor
Wraps api-table member make_quantized_affine.
ClikaRT::make_quantized_affine <- ClikaRT/compute/q_tensor.h
make_quantized_awq / f_make_quantized_awq
fn f_make_quantized_awq(self, qweight: Tensor, qzeros: Tensor, scales: Tensor, bits: i64, group_size: i64) -> Result<QTensor>
fn make_quantized_awq(self, qweight: Tensor, qzeros: Tensor, scales: Tensor, bits: i64, group_size: i64) -> QTensor
Wraps api-table member make_quantized_awq.
ClikaRT::make_quantized_awq <- ClikaRT/compute/q_tensor.h
make_quantized_bnb4 / f_make_quantized_bnb4
fn f_make_quantized_bnb4(self, packed: Tensor, absmax: Tensor, nested_absmax: Tensor, nested_quant_map: Tensor, offset: Tensor, quant_map: Tensor, quant_type: &str, blocksize: i64, nested_blocksize: i64, shape: &[i64]) -> Result<QTensor>
fn make_quantized_bnb4(self, packed: Tensor, absmax: Tensor, nested_absmax: Tensor, nested_quant_map: Tensor, offset: Tensor, quant_map: Tensor, quant_type: &str, blocksize: i64, nested_blocksize: i64, shape: &[i64]) -> QTensor
Wraps api-table member make_quantized_bnb4.
ClikaRT::make_quantized_bnb4 <- ClikaRT/compute/q_tensor.h
make_quantized_ct_pack / f_make_quantized_ct_pack
fn f_make_quantized_ct_pack(self, packed: Tensor, scales: Tensor, bits: i64, group_size: i64) -> Result<QTensor>
fn make_quantized_ct_pack(self, packed: Tensor, scales: Tensor, bits: i64, group_size: i64) -> QTensor
Wraps api-table member make_quantized_ct_pack.
ClikaRT::make_quantized_ct_pack <- ClikaRT/compute/q_tensor.h
make_quantized_fp8 / f_make_quantized_fp8
fn f_make_quantized_fp8(self, codes: Tensor, scale: Tensor, logical_shape: &[i64]) -> Result<QTensor>
fn make_quantized_fp8(self, codes: Tensor, scale: Tensor, logical_shape: &[i64]) -> QTensor
Wraps api-table member make_quantized_fp8.
ClikaRT::make_quantized_fp8 <- ClikaRT/compute/q_tensor.h
make_quantized_fp8_blocked / f_make_quantized_fp8_blocked
fn f_make_quantized_fp8_blocked(self, codes: Tensor, scale: Tensor, block_size: i64, logical_shape: &[i64]) -> Result<QTensor>
fn make_quantized_fp8_blocked(self, codes: Tensor, scale: Tensor, block_size: i64, logical_shape: &[i64]) -> QTensor
Wraps api-table member make_quantized_fp8_blocked.
ClikaRT::make_quantized_fp8_blocked <- ClikaRT/compute/q_tensor.h
make_quantized_gptq / f_make_quantized_gptq
fn f_make_quantized_gptq(self, qweight: Tensor, qzeros: Tensor, scales: Tensor, g_idx: Tensor, bits: i64, group_size: i64, zeros_convention: clika_rt_zeros_convention) -> Result<QTensor>
fn make_quantized_gptq(self, qweight: Tensor, qzeros: Tensor, scales: Tensor, g_idx: Tensor, bits: i64, group_size: i64, zeros_convention: clika_rt_zeros_convention) -> QTensor
Wraps api-table member make_quantized_gptq.
ClikaRT::make_quantized_gptq <- ClikaRT/compute/q_tensor.h
make_quantized_mxfp4 / f_make_quantized_mxfp4
fn f_make_quantized_mxfp4(self, blocks: Tensor, scales: Tensor, logical_shape: &[i64]) -> Result<QTensor>
fn make_quantized_mxfp4(self, blocks: Tensor, scales: Tensor, logical_shape: &[i64]) -> QTensor
Wraps api-table member make_quantized_mxfp4.
ClikaRT::make_quantized_mxfp4 <- ClikaRT/compute/q_tensor.h
make_quantized_nvfp4 / f_make_quantized_nvfp4
fn f_make_quantized_nvfp4(self, codes: Tensor, sub_scales: Tensor, global_scale: Tensor, logical_shape: &[i64]) -> Result<QTensor>
fn make_quantized_nvfp4(self, codes: Tensor, sub_scales: Tensor, global_scale: Tensor, logical_shape: &[i64]) -> QTensor
Wraps api-table member make_quantized_nvfp4.
ClikaRT::make_quantized_nvfp4 <- ClikaRT/compute/q_tensor.h
memory_stats / f_memory_stats
fn f_memory_stats(self, device: clika_rt_device) -> Result<clika_rt_memory_stats>
fn memory_stats(self, device: clika_rt_device) -> clika_rt_memory_stats
Wraps api-table member memory_stats.
ClikaRT::device::memory_stats <- ClikaRT/compute/memory_stats.h
parse_quantization_config / f_parse_quantization_config
fn f_parse_quantization_config(self, json_text: &str) -> Result<QuantizationConfig>
fn parse_quantization_config(self, json_text: &str) -> QuantizationConfig
Wraps api-table member parse_quantization_config.
ClikaRT::quant::parse_quantization_config <- ClikaRT/compute/q_tensor.h
peek_audio_bytes / f_peek_audio_bytes
fn f_peek_audio_bytes(self, bytes: &[u8], target_sample_rate: i32, target_channels: i32) -> Result<clika_rt_audio_info>
fn peek_audio_bytes(self, bytes: &[u8], target_sample_rate: i32, target_channels: i32) -> clika_rt_audio_info
Wraps api-table member peek_audio_bytes.
ClikaRT::io::peek_audio <- ClikaRT/io/io.h
peek_audio_path / f_peek_audio_path
fn f_peek_audio_path(self, path: &str, target_sample_rate: i32, target_channels: i32) -> Result<clika_rt_audio_info>
fn peek_audio_path(self, path: &str, target_sample_rate: i32, target_channels: i32) -> clika_rt_audio_info
Wraps api-table member peek_audio_path.
ClikaRT::io::peek_audio <- ClikaRT/io/io.h
peek_image_bytes / f_peek_image_bytes
fn f_peek_image_bytes(self, bytes: &[u8]) -> Result<clika_rt_image_info>
fn peek_image_bytes(self, bytes: &[u8]) -> clika_rt_image_info
Wraps api-table member peek_image_bytes.
ClikaRT::io::peek_image <- ClikaRT/io/io.h
peek_image_path / f_peek_image_path
fn f_peek_image_path(self, path: &str) -> Result<clika_rt_image_info>
fn peek_image_path(self, path: &str) -> clika_rt_image_info
Wraps api-table member peek_image_path.
ClikaRT::io::peek_image <- ClikaRT/io/io.h
quantized_view / f_quantized_view
fn f_quantized_view(self, tensor: Tensor) -> Result<QTensor>
fn quantized_view(self, tensor: Tensor) -> QTensor
Wraps api-table member quantized_view.
ClikaRT::quantized_view <- ClikaRT/compute/q_tensor.h
release_cached_memory / f_release_cached_memory
fn f_release_cached_memory(self, device: clika_rt_device) -> Result<()>
fn release_cached_memory(self, device: clika_rt_device)
Wraps api-table member release_cached_memory.
ClikaRT::device::release_cached_memory <- ClikaRT/compute/memory_stats.h
save_audio / f_save_audio
fn f_save_audio(self, samples: &Tensor, sample_rate: i32, path: &str) -> Result<()>
fn save_audio(self, samples: &Tensor, sample_rate: i32, path: &str)
Wraps api-table member save_audio.
ClikaRT::io::save_audio <- ClikaRT/io/io.h
save_image / f_save_image
fn f_save_image(self, image: &Tensor, path: &str) -> Result<()>
fn save_image(self, image: &Tensor, path: &str)
Wraps api-table member save_image.
ClikaRT::io::save_image <- ClikaRT/io/io.h
save_npy / f_save_npy
fn f_save_npy(self, tensor: &Tensor, path: &str) -> Result<()>
fn save_npy(self, tensor: &Tensor, path: &str)
Wraps api-table member save_npy.
ClikaRT::io::save_npy <- ClikaRT/io/io.h
temp_directory_path / f_temp_directory_path
fn f_temp_directory_path(self) -> Result<StringList>
fn temp_directory_path(self) -> StringList
Wraps api-table member temp_directory_path.
ClikaRT::io::temp_directory_path <- ClikaRT/io/io.h
trace_abort
fn trace_abort(self, session: TraceSession)
Wraps api-table member trace_abort.
discard the capture without building anything; consumes session (contract §6; NULL is a no-op); also the session's release road
trace_begin / f_trace_begin
fn f_trace_begin(self, signature: &[clika_rt_tensor_spec], graph_name: &str, options: Option<&clika_rt_trace_options>) -> Result<(TensorList, TraceSession)>
fn trace_begin(self, signature: &[clika_rt_tensor_spec], graph_name: &str, options: Option<&clika_rt_trace_options>) -> (TensorList, TraceSession)
Wraps api-table member trace_begin.
open a scoped capture ON THIS THREAD: one data-free stand-in per signature spec (returned as a tensor list, caller-released); ops called on the stand-ins between begin and end record into the graph instead of computing. options NULL = defaults
trace_end / f_trace_end
fn f_trace_end(self, session: TraceSession, outputs: &[&Tensor], output_names: &[&str], output_name_lens: &[usize]) -> Result<ModelGraph>
fn trace_end(self, session: TraceSession, outputs: &[&Tensor], output_names: &[&str], output_name_lens: &[usize]) -> ModelGraph
Wraps api-table member trace_end.
finish the capture: outputs are BORROWED (the graph's declared outputs, positionally); 0 names = positional defaults. consumes session (contract §6) in every outcome, success and failure alike
version
fn version(self) -> Result<String>
The runtime's version string (e.g. "0.1.0").
version_string / f_version_string
fn f_version_string(self) -> Result<String>
fn version_string(self) -> String
Wraps api-table member version_string.
video_capability
fn video_capability(self) -> bool
Wraps api-table member video_capability.
ClikaRT::io::video_capability <- ClikaRT/io/io.h