public class DeviceQuantizedMatrix implements AutoClosable
Resident CPU or NVIDIA weights, loaded in bounded blocks. GGUF F16, BF16 and K-quants retain their original packed storage; Q8 uses unchanged codes with FP32 scales. No full floating expansion or duplicate host weight copy is retained. Close explicitly after use; the GC also releases abandoned device allocations. Operations on a closed resource fail rather than selecting another execution device. Higher-rank checkpoint weights flatten all dimensions except the last.
try matrix = DeviceQuantizedMatrix(Path("model-q8.safetensors"), "projection.weight"): print(matrix.multiply(NDArray<Float>.ones([1l, matrix.columns])))
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | columnscolumns as Long |
Last tensor dimension. |
| public readonly property | devicedevice as Device |
Concrete CPU or NVIDIA device owning this allocation. |
| public readonly property | rowsrows as Long |
Flattened output rows. |
| public readonly property | shape | Original checkpoint dimensions. |
| public readonly property | storageBytesstorageBytes as ULong |
Physical packed weight and scale bytes. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | DeviceQuantizedMatrixDeviceQuantizedMatrix(notnull values as NDArray<Float>, device as Device = Device.auto) |
Copies a computed F32 matrix into owned resident storage in bounded blocks. |
| public | DeviceQuantizedMatrixDeviceQuantizedMatrix(path as Path, name as String, device as Device = Device.auto) |
Loads one Q8 tensor without retaining the open file. |
| public | DeviceQuantizedMatrix | Loads exact GGUF F32, F16, BF16, Q8_0, Q4_K, Q5_K or Q6_K parameters. |
| public | DeviceQuantizedMatrixDeviceQuantizedMatrix(reader as SafetensorsReader, info as TensorInfo, device as Device, buffer as Byte[]) |
Loads a published F32/F16/BF16 Safetensors matrix in its original encoding, without silently quantizing it. |
| public | DeviceQuantizedMatrixDeviceQuantizedMatrix(reader as SafetensorsReader, name as String, device as Device, buffer as Byte[] = null) |
Loads through a shared descriptor reader; the caller owns and closes it. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | closeclose() as Void |
Releases packed device storage immediately and idempotently. |
| public | convolveInto | One causal depthwise convolution followed by SiLU, updating its history. |
| public | embeddingInto | Decodes one embedding row into a reusable Float buffer, on its device. |
| public | multiply | Computes [batch, columns] times the packed weight transpose on its device. |
| public | multiplyInto | Uses a reusable result buffer inside the owning CPU/GPU execution scope. |