Reverted some of the changes.
This commit is contained in:
parent
eaa69ba50b
commit
0d1f2d0bcc
@ -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(
|
||||
|
@ -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_
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user