Reverted some of the changes.

This commit is contained in:
Anthony Platanios 2017-08-28 16:44:15 -04:00 committed by Martin Wicke
parent eaa69ba50b
commit 0d1f2d0bcc
3 changed files with 10 additions and 10 deletions

View File

@ -537,7 +537,14 @@ void TFE_ContextAddFunctionDef(TFE_Context* ctx,
} // extern "C"
TFE_TensorHandle* TFE_NewTensorHandle(const tensorflow::Tensor& t) {
return new TFE_TensorHandle(t, 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;
}
const tensorflow::Tensor* TFE_TensorHandleUnderlyingTensorInHostMemory(

View File

@ -153,7 +153,7 @@ class Tensor;
const tensorflow::Tensor* TFE_TensorHandleUnderlyingTensorInHostMemory(
TFE_TensorHandle* h, TF_Status* status);
TFE_TensorHandle* TFE_NewTensorHandle(const tensorflow::Tensor& t, TF_Status* status);
TFE_TensorHandle* TFE_NewTensorHandle(const tensorflow::Tensor& t);
#endif
#endif // TENSORFLOW_C_EAGER_C_API_H_

View File

@ -347,14 +347,7 @@ TFE_TensorHandle* TFE_Py_NumpyToTensorHandle(PyObject* obj) {
tensorflow::Tensor t;
auto cppstatus = tensorflow::NdarrayToTensor(obj, &t);
if (cppstatus.ok()) {
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;
return TFE_NewTensorHandle(t);
} else {
tensorflow::mutex_lock l(exception_class_mutex);
auto msg = tensorflow::strings::StrCat(