message: Rolling forward "In SparseTensor::Create and constructor, forward Tensor arguments using std::move."
  The previous version had a bug: the moved-from Tensor arguments were used (i) in a subsequent initializer for SparseTensor::dims_, and (ii) in the DCHECK invocations in the constructor.
diff: @@ -74,55 +74,59 @@ class SparseTensor {
  "Shape rank must be SparseTensor rank.");
  }
  - *result = SparseTensor(ix, vals, shape, order);
  + *result = SparseTensor(std::move(ix), std::move(vals), shape, order);
  return Status();
  }
  static Status Create(Tensor ix, Tensor vals, const TensorShape& shape,
  SparseTensor* result) {
  - return Create(ix, vals, TensorShapeToVector(shape),
  + return Create(std::move(ix), std::move(vals), TensorShapeToVector(shape),
  UndefinedOrder(TensorShapeToVector(shape)), result);
  }
  static Status Create(Tensor ix, Tensor vals, const VarDimArray shape,
  SparseTensor* result) {
  - return Create(ix, vals, shape, UndefinedOrder(shape), result);
  + return Create(std::move(ix), std::move(vals), shape, UndefinedOrder(shape),
  + result);
  }
  static Status Create(Tensor ix, Tensor vals, const TensorShape& shape,
  const VarDimArray order, SparseTensor* result) {
  - return Create(ix, vals, TensorShapeToVector(shape), order, result);
  + return Create(std::move(ix), std::move(vals), TensorShapeToVector(shape),
  + order, result);
  }
  SparseTensor() : dims_(0) {}
  ABSL_DEPRECATED("Use Create() functions instead of constructors directly.")
  SparseTensor(Tensor ix, Tensor vals, const TensorShape& shape)
  - : SparseTensor(ix, vals, TensorShapeToVector(shape),
  + : SparseTensor(std::move(ix), std::move(vals), TensorShapeToVector(shape),
  UndefinedOrder(TensorShapeToVector(shape))) {}
  ABSL_DEPRECATED("Use Create() functions instead of constructors directly.")
  SparseTensor(Tensor ix, Tensor vals, const VarDimArray shape)
  - : SparseTensor(ix, vals, shape, UndefinedOrder(shape)) {}
  + : SparseTensor(std::move(ix), std::move(vals), shape,
  + UndefinedOrder(shape)) {}
  ABSL_DEPRECATED("use Create() functions instead of constructors directly.")
  SparseTensor(Tensor ix, Tensor vals, const TensorShape& shape,
  const VarDimArray order)
  - : SparseTensor(ix, vals, TensorShapeToVector(shape), order) {}
  + : SparseTensor(std::move(ix), std::move(vals), TensorShapeToVector(shape),
  + order) {}
  ABSL_DEPRECATED("Use Create() functions instead of constructors directly.")
  SparseTensor(Tensor ix, Tensor vals, const VarDimArray shape,
  const VarDimArray order)
  - : ix_(ix),
  - vals_(vals),
  + : ix_(std::move(ix)),
  + vals_(std::move(vals)),
  shape_(shape.begin(), shape.end()),
  order_(order.begin(), order.end()),
  - dims_(UnsafeGetDimsFromIx(ix)) {
  - DCHECK_EQ(ix.dtype(), DT_INT64)
  - << "indices must be type int64 but got: " << ix.dtype();
  - DCHECK(TensorShapeUtils::IsVector(vals.shape()))
  - << "vals must be a vec, but got: " << vals.shape().DebugString();
  - DCHECK_EQ(ix.shape().dim_size(0), vals.shape().dim_size(0))
  + dims_(UnsafeGetDimsFromIx(ix_)) {
  + DCHECK_EQ(ix_.dtype(), DT_INT64)
  + << "indices must be type int64 but got: " << ix_.dtype();
  + DCHECK(TensorShapeUtils::IsVector(vals_.shape()))
  + << "vals must be a vec, but got: " << vals_.shape().DebugString();
  + DCHECK_EQ(ix_.shape().dim_size(0), vals_.shape().dim_size(0))
  << "indices and values rows (indexing dimension) must match.";
  DCHECK_EQ(order.size(), dims_) << "Order length must be SparseTensor rank.";
  DCHECK_EQ(shape.size(), dims_) << "Shape rank must be SparseTensor rank.";
  