//clika-runtime/io.clika.runtime
Package-level declarations
Types
| Name | Summary |
|---|---|
| AudioInfo | [jvm] data class AudioInfo(var sampleRate: Int = 0, var channels: Int = 0, var frames: Long = 0) An audio stream's effective layout ( clika_rt_audio_info). |
| ClikaRt | [jvm] object ClikaRt The Kotlin binding over the ClikaRT C core ABI (v0 call slice). |
| ClikaRtException | [jvm] class ClikaRtException(val status: Int, val codeName: String, message: String) : RuntimeException A runtime failure. codeName is the machine-readable channel that survives every build flavor; branch on it, never on the message text (release builds may show an opaque message code). |
| ClikaRtGen | [jvm] object ClikaRtGen The generated api-table surface. Handles ride raw Long values (pair a tensor Long with Tensor via the hand-written core where a typed handle is wanted); enums ride their C values (the constants below); runtime failures throw ClikaRtException; branch on codeName, never on the message text. load resolves the already-loaded runtime and performs the two-arm handshake (the abi version, then the api-table layout fingerprint) exactly like ClikaRt.load; call either one before the first wrapped call. |
| Device | [jvm] data class Device(val api: Int, val index: Int = 0) A compute placement: the device= value the factories and movers take. |
| F | [jvm] object F The functional namespace: stateless spellings of the runtime ops, keyword-defaulted per the binding signature conventions. |
| ImageInfo | [jvm] data class ImageInfo(var height: Long = 0, var width: Long = 0, var channels: Long = 0) An image header's geometry ( clika_rt_image_info). |
| Linear | [jvm] class Linear@JvmOverloadsconstructor(weight: Tensor, bias: Tensor? = null, activation: Int? = null) : Module, AutoCloseable A dense layer: input @ weight^T + bias, with an optional fused activation (ClikaRtGen.ACTIVATION_*). |
| MemoryStats | [jvm] data class MemoryStats(var deviceFreeBytes: Long = 0, var deviceTotalBytes: Long = 0, var activeBytes: Long = 0, var requestedBytes: Long = 0, var reservedBytes: Long = 0, var cachedBytes: Long = 0, var peakActiveBytes: Long = 0, var peakReservedBytes: Long = 0, var numAllocs: Long = 0, var numFrees: Long = 0, var numOom: Long = 0, var wrappedBytes: Long = 0, var wrappedAllocs: Long = 0) A device's runtime memory-pool counters ( clika_rt_memory_stats): the allocator-level oracle. Byte counts and tallies are unsigned 64-bit in C and ride Long here. |
| ModelGraph | [jvm] class ModelGraph : AutoCloseable A compiled, runnable graph (the consume half: load + run). |
| Module | [jvm] interface Module The module-system floor: Module, Linear, Sequential. |
| OnnxModel | [jvm] class OnnxModel : AutoCloseable An ONNX model handle: the source a ModelGraph compiles from. |
| Sequential | [jvm] class Sequential(modules: Module) : Module, AutoCloseable Runs its modules in order, releasing every intermediate tensor it produced (the caller's input and the returned output are untouched). |
| Tensor | [jvm] class Tensor : AutoCloseable A caller-owned tensor handle; release it when done (the last release frees the storage). Ops that CONSUME their operand (the donation law; see ClikaRt.addScalar) zero the handle, making a later release a no-op. |
| TensorCallback | [jvm] fun interface TensorCallback A callback carrying a tensor: Tensor.onComplete's notification. The Tensor handed in is the callback's for the duration of the call only: whatever reference it does not Tensor.release itself is released when the callback returns. A callback that needs the tensor past its return takes an independent reference ( ClikaRtGen.tensorRetain on a handle it then owns), never the argument object. |
| Tensors | [jvm] object Tensors The tensor factories and data entry. |
| VoidCallback | [jvm] fun interface VoidCallback A callback with no payload: the deleter of a wrapped buffer (Tensors.fromBlob / Tensors.fromBlobStrided). The runtime runs it exactly once, when the last reference to the wrapping tensor drops, on whichever thread that happens; the callback already holds the buffer it is being told to release, so nothing is passed. |
Functions
| Name | Summary |
|---|---|
| cast | [jvm] fun Tensor.cast(dtype: Int, forceCopy: Boolean = false): Tensor Convert to dtype through the runtime (never host-side float math). |
| div | [jvm] operator fun Tensor.div(other: Tensor): Tensor this / other, elementwise with broadcasting (true division).[jvm] operator fun Tensor.div(scalar: Double): Tensor operator fun Tensor.div(scalar: Int): Tensor this / scalar, elementwise.[jvm] operator fun Double.div(t: Tensor): Tensor scalar / t, elementwise: the scalar divided BY each element. |
| dtype | [jvm] fun Tensor.dtype(): Int The tensor's dtype, as a ClikaRtGen.DATA_TYPE_* value. |
| item | [jvm] fun Tensor.item(): Float The one element of a single-element Float32 tensor (a reduction's result). Waits for the producer; refuses a numel other than 1 or another dtype (ClikaRtException). |
| itemDouble | [jvm] fun Tensor.itemDouble(): Double item for a Float64 tensor. |
| itemInt | [jvm] fun Tensor.itemInt(): Int item for an Int32 tensor. |
| itemLong | [jvm] fun Tensor.itemLong(): Long item for an Int64 tensor. |
| matmul | [jvm] infix fun Tensor.matmul(other: Tensor): Tensor t @ w: matrix multiplication (Kotlin has no @; the named infix). |
| minus | [jvm] operator fun Tensor.minus(other: Tensor): Tensor this - other, elementwise with broadcasting.[jvm] operator fun Tensor.minus(scalar: Double): Tensor operator fun Tensor.minus(scalar: Int): Tensor this - scalar, elementwise.[jvm] operator fun Double.minus(t: Tensor): Tensor scalar - t, elementwise: each element subtracted FROM the scalar. |
| onComplete | [jvm] fun Tensor.onComplete(callback: TensorCallback) Register callback to run once this tensor's producer has finished (the moment the tensor becomes available; a tensor that is already available fires it right away). Non-consuming: this tensor stays the caller's. |
| plus | [jvm] operator fun Tensor.plus(other: Tensor): Tensor this + other, elementwise with broadcasting.[jvm] operator fun Tensor.plus(scalar: Double): Tensor operator fun Tensor.plus(scalar: Int): Tensor this + scalar, elementwise.[jvm] operator fun Double.plus(t: Tensor): Tensor scalar + t: the commutative mirror. |
| shape | [jvm] fun Tensor.shape(): LongArray The tensor's shape (the recorded bound for a data-dependent producer). |
| summary | [jvm] fun Tensor.summary(): String The tensor's human-readable summary (shape, dtype, device, first values). Rides the generated surface, so it works under either ClikaRt.load or ClikaRtGen.load. |
| times | [jvm] operator fun Tensor.times(other: Tensor): Tensor this * other, elementwise with broadcasting.[jvm] operator fun Tensor.times(scalar: Double): Tensor operator fun Tensor.times(scalar: Int): Tensor this * scalar, elementwise.[jvm] operator fun Double.times(t: Tensor): Tensor scalar * t: the commutative mirror. |
| to | [jvm] fun Tensor.to(device: Device): Tensor Move to device. Non-consuming. [jvm] fun Tensor.to(device: String): Tensor Move to device (string form, e.g. "cuda:0"). Non-consuming. |
| toDoubleArray | [jvm] fun Tensor.toDoubleArray(): DoubleArray toFloatArray for a Float64 tensor. |
| toFloatArray | [jvm] fun Tensor.toFloatArray(): FloatArray Every element of a 0-D or 1-D contiguous Float32 tensor, copied out (waits for the producer). Reshape a higher-rank tensor to 1-D first. |
| toIntArray | [jvm] fun Tensor.toIntArray(): IntArray toFloatArray for an Int32 tensor. |
| toLongArray | [jvm] fun Tensor.toLongArray(): LongArray toFloatArray for an Int64 tensor. |
| unaryMinus | [jvm] operator fun Tensor.unaryMinus(): Tensor -this, elementwise. |