operator unary- method Null safety

Tensor<T> operator unary-()

Calculates scale(-1.0).

The formula for result element i is:

-elements[i];

The returned tensor will have identical type and tensorShape.

Implementation

Tensor<T> operator -() {
  final builder = toBuilder();
  builder.neg();
  return builder.build();
}