operator + method Null safety

Tensor<T> operator +(
  1. Tensor<T> right
)

Calculates element-wise sum.

The formula for result element i is:

elements[i] + right.elements[i];

Throws ArgumentError if tensor shapes are not equal.

Implementation

Tensor<T> operator +(Tensor<T> right) {
  final builder = toBuilder();
  builder.add(right);
  return builder.build();
}