From 59d8c5b6c0d91532b081f342ebfffd7fb464d5df Mon Sep 17 00:00:00 2001 From: VoVAllen Date: Fri, 21 Feb 2020 15:22:48 +0000 Subject: [PATCH] fix --- tensorflow/c/eager/dlpack.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tensorflow/c/eager/dlpack.cc b/tensorflow/c/eager/dlpack.cc index f982e483bbc..fbe64499d3f 100644 --- a/tensorflow/c/eager/dlpack.cc +++ b/tensorflow/c/eager/dlpack.cc @@ -30,7 +30,6 @@ namespace { struct TFDLManagedTensorCtx { TensorReference* handle; std::vector shape; - std::vector strides; DLManagedTensor tensor; }; @@ -145,14 +144,14 @@ DLManagedTensor* TFEHandleToTFDLManagedTensorCtx(TFE_TensorHandle* h, std::vector* shape_arr = &tf_dlm_tensor_ctx->shape; std::vector* stride_arr = &tf_dlm_tensor_ctx->strides; shape_arr->resize(ndim); - stride_arr->resize(ndim); for (int i = 0; i < ndim; i++) { - (*shape_arr)[i] = tensor->dim_size(i); - (*stride_arr)[i] = 1; + (*shape_arr)[i] = tensor->dim_size(i); } - tf_dlm_tensor_ctx->tensor.dl_tensor.shape = reinterpret_cast(shape_arr->data()); - tf_dlm_tensor_ctx->tensor.dl_tensor.strides = reinterpret_cast(stride_arr->data()); + tf_dlm_tensor_ctx->tensor.dl_tensor.shape = + reinterpret_cast(shape_arr->data()); + tf_dlm_tensor_ctx->tensor.dl_tensor.strides = + nullptr; // NULL indicates tensor is compact and row-majored. tf_dlm_tensor_ctx->tensor.dl_tensor.byte_offset = 0; // TF doesn't handle the strides and byte_offsets here return &tf_dlm_tensor_ctx->tensor;