addInPlace method

void addInPlace(
  1. Tensor2D other
)

In-place add another tensor with the same shape.

Implementation

void addInPlace(Tensor2D other) {
  if (other.rows != rows || other.cols != cols) {
    throw ArgumentError('shape mismatch in addInPlace');
  }
  for (var k = 0; k < data.length; k++) {
    data[k] += other.data[k];
  }
}