apply method

void apply(
  1. Float32List xs,
  2. Float32List ys,
  3. int n
)

yst * rows + r = (W xst)r for t < n, xs as n, cols. One vector uses a GEMV kernel, a batch a GEMM kernel.

Implementation

void apply(Float32List xs, Float32List ys, int n) {
  if (rows == 0) return;
  switch (_weights) {
    case Float32List w:
      n == 1 ? gemv(w, xs, ys, rows, cols) : gemm(w, xs, ys, rows, cols, n);
    case QuantizedMatrix q:
      n == 1 ? q.gemv(xs, ys) : q.gemm(xs, ys, n);
    case NativeMatrix q:
      q.apply(xs, ys, n);
  }
}