mulElem static method

Tensor2D mulElem(
  1. Tensor2D a,
  2. Tensor2D b
)

Implementation

static Tensor2D mulElem(Tensor2D a, Tensor2D b) {
  if (a.rows != b.rows || a.cols != b.cols) {
    throw ArgumentError('mulElem: shape mismatch');
  }
  final out = Tensor2D.zeros(a.rows, a.cols);
  for (var i = 0; i < out.data.length; i++) {
    out.data[i] = a.data[i] * b.data[i];
  }
  return out;
}