[Filter/Tensorflow] add an exception case for tensorflow
authorHyoungjooAhn <hello.ahnn@gmail.com>
Wed, 19 Dec 2018 04:26:28 +0000 (13:26 +0900)
committerMyungJoo Ham <myungjoo.ham@gmail.com>
Thu, 20 Dec 2018 06:11:10 +0000 (15:11 +0900)
checking the status of tensorflow after running model

Signed-off-by: HyoungjooAhn <hello.ahnn@gmail.com>
gst/tensor_filter/tensor_filter_tensorflow_core.cc

index 5a7e93b..24e4757 100644 (file)
@@ -375,6 +375,7 @@ TFCore::getOutputTensorDim (GstTensorsInfo * info)
  * @param[in] input : The array of input tensors
  * @param[out]  output : The array of output tensors
  * @return 0 if OK. non-zero if error.
+ *         -1 if the model is not works properly.
  */
 int
 TFCore::run (const GstTensorMemory * input, GstTensorMemory * output)
@@ -441,6 +442,10 @@ TFCore::run (const GstTensorMemory * input, GstTensorMemory * output)
   Status run_status =
       session->Run(input_feeds, output_tensor_names, {}, &outputs);
 
+  if (run_status != Status::OK()){
+    GST_ERROR ("Failed to run model: %s\n", run_status.ToString ());
+    return -1;
+  }
 
   for (int i = 0; i < outputTensorMeta.num_tensors; i++) {
     output[i].type = getTensorTypeFromTF(outputs[i].dtype());