From eaa69ba50b915f15ebe5ee76097b9f691a744617 Mon Sep 17 00:00:00 2001 From: Anthony Platanios Date: Mon, 28 Aug 2017 16:02:47 -0400 Subject: [PATCH] Fixed a bug. --- tensorflow/python/eager/pywrap_tfe_src.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tensorflow/python/eager/pywrap_tfe_src.cc b/tensorflow/python/eager/pywrap_tfe_src.cc index 8146d9de141..311bbc9477c 100644 --- a/tensorflow/python/eager/pywrap_tfe_src.cc +++ b/tensorflow/python/eager/pywrap_tfe_src.cc @@ -347,8 +347,13 @@ TFE_TensorHandle* TFE_Py_NumpyToTensorHandle(PyObject* obj) { tensorflow::Tensor t; auto cppstatus = tensorflow::NdarrayToTensor(obj, &t); if (cppstatus.ok()) { - TFE_TensorHandle* tensor = TFE_NewTensorHandle(t, cppstatus); - if (!cppstatus.ok()) return nullptr; + TF_Status* status = TF_NewStatus(); + TFE_TensorHandle* tensor = TFE_NewTensorHandle(t, status); + if (TF_GetCode(status) != TF_OK) { + TF_DeleteStatus(status); + return nullptr; + } + TF_DeleteStatus(status); return tensor; } else { tensorflow::mutex_lock l(exception_class_mutex);