min method Null safety

  1. @override
void min(
  1. Tensor<double> right
)
override

Calculates element-wise minimum of the two tensors.

Element i is calculated with the formula:

x[i] = min(x[i], right[i]);

Throws ArgumentError if tensor shapes are not equal.

Implementation

@override
void min(Tensor<double> right) {
  _checkSameShape(right);
  final elements = this.elements;
  final rightElements = right.elements;
  final n = length;
  for (var i = 0; i < n; i++) {
    elements[i] = math.min(elements[i], rightElements[i]);
  }
}