Fixed a bug.
This commit is contained in:
parent
26c4a2c1ec
commit
eaa69ba50b
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user