addRowwise static method

Tensor2D addRowwise(
  1. Tensor2D a,
  2. Float64List bias
)

Implementation

static Tensor2D addRowwise(Tensor2D a, Float64List bias) {
  if (a.cols != bias.length) {
    throw ArgumentError('addRowwise: bias len != a.cols');
  }
  final out = a.clone();
  for (var i = 0; i < a.rows; i++) {
    final base = i * a.cols;
    for (var j = 0; j < a.cols; j++) {
      out.data[base + j] += bias[j];
    }
  }
  return out;
}