From: Yongjoo Ahn Date: Tue, 3 Jan 2023 08:27:55 +0000 (+0900) Subject: [fix][tensor_filter] Fix the first output with garbage value with tflite X-Git-Tag: accepted/tizen/unified/20230118.172039~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c7b11151b7313ecdf5ec7dd8f0e4cc22b7a2922;p=platform%2Fupstream%2Fnnstreamer.git [fix][tensor_filter] Fix the first output with garbage value with tflite - The output buffer address may change after the first invoke. - To handle this case, Memcpy the output from tflite interpreter at the first invoke. Signed-off-by: Yongjoo Ahn --- diff --git a/ext/nnstreamer/tensor_filter/tensor_filter_tensorflow_lite.cc b/ext/nnstreamer/tensor_filter/tensor_filter_tensorflow_lite.cc index e939439..d7693e5 100644 --- a/ext/nnstreamer/tensor_filter/tensor_filter_tensorflow_lite.cc +++ b/ext/nnstreamer/tensor_filter/tensor_filter_tensorflow_lite.cc @@ -356,7 +356,11 @@ TFLiteInterpreter::invoke (const GstTensorMemory *input, GstTensorMemory *output start_time = g_get_monotonic_time (); status = interpreter->Invoke (); - if (is_xnnpack_delegated) { + /** + * After the very first invoke, the output buffer address may change. + * To handle the case, memcpy the output buffer directly. + */ + if (is_xnnpack_delegated || !is_cached_after_first_invoke) { for (unsigned int i = 0; i < outputTensorMeta.num_tensors; ++i) { tensor_ptr = outputTensorPtr[i]; g_assert(tensor_ptr->bytes == output[i].size);