From 34815b5001b07607aaefc79ae844591f1bb33a60 Mon Sep 17 00:00:00 2001 From: dskkato Date: Thu, 11 Nov 2021 14:01:59 +0900 Subject: [PATCH] [tensorflow-sys] add status check code. --- tensorflow-sys/tests/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tensorflow-sys/tests/lib.rs b/tensorflow-sys/tests/lib.rs index 0cc61de099..946b9844db 100644 --- a/tensorflow-sys/tests/lib.rs +++ b/tensorflow-sys/tests/lib.rs @@ -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);