NativeQ8Matrix.quantize constructor
NativeQ8Matrix.quantize(
- Float32List w,
- int rows,
- int cols
Implementation
factory NativeQ8Matrix.quantize(Float32List w, int rows, int cols) {
if (cols % 32 != 0) {
throw ArgumentError('Q8 needs cols to be a multiple of 32, got $cols');
}
final qs = NativeKernels.allocate<Int8>(rows * cols);
final scales = NativeKernels.allocate<Float>(rows * cols ~/ 32 * 4);
_quantizeQ8(w.address, qs, scales, rows, cols);
return NativeQ8Matrix._(rows, cols, qs, scales);
}