Skip to content

Commit

Permalink
[tensorflow-sys] add status check code.
Browse files Browse the repository at this point in the history
  • Loading branch information
dskkato committed Nov 11, 2021
1 parent aa9f6cc commit 34815b5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tensorflow-sys/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ fn tfe_tensor_handle() {
);
let status = ffi::TF_NewStatus();
let tfe_handle = ffi::TFE_NewTensorHandle(tf_tensor, status);
if ffi::TF_GetCode(status) != ffi::TF_OK {
panic!(
"{}",
std::ffi::CStr::from_ptr(ffi::TF_Message(status))
.to_string_lossy()
.into_owned()
);
}

ffi::TF_DeleteStatus(status);
ffi::TFE_DeleteTensorHandle(tfe_handle);
Expand Down

0 comments on commit 34815b5

Please sign in to comment.