Fixed a bug.

This commit is contained in:
Anthony Platanios 2017-08-28 16:02:47 -04:00 committed by Martin Wicke
parent 26c4a2c1ec
commit eaa69ba50b

View File

@ -347,8 +347,13 @@ TFE_TensorHandle* TFE_Py_NumpyToTensorHandle(PyObject* obj) {
tensorflow::Tensor t; tensorflow::Tensor t;
auto cppstatus = tensorflow::NdarrayToTensor(obj, &t); auto cppstatus = tensorflow::NdarrayToTensor(obj, &t);
if (cppstatus.ok()) { if (cppstatus.ok()) {
TFE_TensorHandle* tensor = TFE_NewTensorHandle(t, cppstatus); TF_Status* status = TF_NewStatus();
if (!cppstatus.ok()) return nullptr; TFE_TensorHandle* tensor = TFE_NewTensorHandle(t, status);
if (TF_GetCode(status) != TF_OK) {
TF_DeleteStatus(status);
return nullptr;
}
TF_DeleteStatus(status);
return tensor; return tensor;
} else { } else {
tensorflow::mutex_lock l(exception_class_mutex); tensorflow::mutex_lock l(exception_class_mutex);