NativeQ8Matrix class final
A row-major rows, cols matrix quantized to Q8 in native memory.
- Implemented types
Constructors
-
NativeQ8Matrix.fromPointers(int rows, int cols, Pointer<
Int8> qs, Pointer<Float> scales) -
Wraps Q8 data that already exists in native memory, such as a mapped
cache file:
qsholds rows * cols int8,scalesrows * cols / 32.factory - NativeQ8Matrix.quantize(Float32List w, int rows, int cols)
-
factory
- NativeQ8Matrix.quantizeRows(int rows, int cols, void fill(int first, int count, Float32List out), {int chunk = 1024})
-
Quantizes a matrix too large to hold in float32 at once:
fillwritescountrows starting at rowfirstinto its list,chunkat a time.factory
Properties
- bytes → int
-
no setter
- cols → int
-
final
- format → String
-
q8orq4.no setteroverride - hashCode → int
-
The hash code for this object.
no setterinherited
- qsBytes → Uint8List
-
The raw quantized values and scales, as written to the file.
no setteroverride
- rows → int
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleBytes → Uint8List
-
no setteroverride
Methods
-
apply(
Float32List xs, Float32List ys, int n, {bool? int8Inputs}) → void -
ys
t * rows + r= (W xst)rfor t < n, xs asn, cols.int8Inputsoverrides the process-wide setting (for tests).override -
dequantizeRow(
int r, Float32List out, int offset) → void -
Writes row
r, dequantized, intooutatoffset: token lookup in an embedding that exists only as the tied, quantized LM head. -
free(
) → void -
Frees the memory of a matrix made by quantizing. The matrix must not
be used afterwards.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
weightAt(
int r, int c) → double -
The weight the kernel uses at (r, c), for tests.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited