aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/kernels/edit_distance_op.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/core/kernels/edit_distance_op.cc')
-rw-r--r--tensorflow/core/kernels/edit_distance_op.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/tensorflow/core/kernels/edit_distance_op.cc b/tensorflow/core/kernels/edit_distance_op.cc
index 20d857c721..4aecdc9e41 100644
--- a/tensorflow/core/kernels/edit_distance_op.cc
+++ b/tensorflow/core/kernels/edit_distance_op.cc
@@ -133,10 +133,15 @@ class EditDistanceOp : public OpKernel {
std::vector<int64> sorted_order(truth_st_shape.dims());
std::iota(sorted_order.begin(), sorted_order.end(), 0);
- sparse::SparseTensor hypothesis(*hypothesis_indices, *hypothesis_values,
- hypothesis_st_shape, sorted_order);
- sparse::SparseTensor truth(*truth_indices, *truth_values, truth_st_shape,
- sorted_order);
+ sparse::SparseTensor hypothesis;
+ OP_REQUIRES_OK(ctx, sparse::SparseTensor::Create(
+ *hypothesis_indices, *hypothesis_values,
+ hypothesis_st_shape, sorted_order, &hypothesis));
+
+ sparse::SparseTensor truth;
+ OP_REQUIRES_OK(ctx, sparse::SparseTensor::Create(
+ *truth_indices, *truth_values, truth_st_shape,
+ sorted_order, &truth));
// Group dims 0, 1, ..., RANK - 1. The very last dim is assumed
// to store the variable length sequences.