klyn.math.nn.quantization.GpuQuantizedMatrix.GpuQuantizedMatrix
constructor
public GpuQuantizedMatrix(reader as GGUFReader, info as GGUFTensor, device as Device, buffer as Byte[], reorder as Int = 0, keyHeads as Long = 1l, valueHeads as Long = 1l, valueDim as Long = 1l)
Description

Loads exact GGUF F32, F16, BF16, Q8_0, Q4_K, Q5_K or Q6_K parameters. Q8 scales widen losslessly to F32; integer codes remain unchanged. Other formats decode only in GPU registers without expansion or requantization. The optional permutation restores logical HF head ordering.

Parameters
ParameterDescription
readerValidated GGUF descriptor reader.
infoSelected tensor.
deviceNVIDIA GPU selector.
bufferShared bounded upload buffer.
reorderInternal Qwen head-layout permutation selector.
keyHeadsLinear key head count.
valueHeadsLinear value head count.
valueDimLinear value width.
Throws
  • ValueException for unsupported encoding, dimensions or device.
Example

matrix = GpuQuantizedMatrix(reader, reader.tensors["output.weight"], Device.gpu[0], buffer)