ml-models-public: Refactor process_output With MlOutput being removed we just need to set the length instead. Change-Id: Ife7971bbd47860dc3300304793efe7d8982dfc82
diff --git a/float_models/iree_exec/mnist.c b/float_models/iree_exec/mnist.c index e40197e..bab3cf4 100644 --- a/float_models/iree_exec/mnist.c +++ b/float_models/iree_exec/mnist.c
@@ -65,7 +65,7 @@ iree_status_t process_output(const MlModel *model, iree_hal_buffer_mapping_t *buffers, - MlOutput *output) { + uint32_t *output_length) { iree_status_t result = iree_ok_status(); // find the label index with best prediction float best_out = 0.0; @@ -83,7 +83,6 @@ LOG_INFO("Digit recognition result is: digit: %d", best_idx); - output->result = &score; - output->len = sizeof(score); + *output_length = sizeof(score); return result; }
diff --git a/float_models/iree_exec/mobilenet_v1.c b/float_models/iree_exec/mobilenet_v1.c index d6a6a1d..98b82d0 100644 --- a/float_models/iree_exec/mobilenet_v1.c +++ b/float_models/iree_exec/mobilenet_v1.c
@@ -69,7 +69,7 @@ iree_status_t process_output(const MlModel *model, iree_hal_buffer_mapping_t *buffers, - MlOutput *output) { + uint32_t *output_length) { iree_status_t result = iree_ok_status(); // find the label index with best prediction float best_out = 0.0; @@ -86,7 +86,6 @@ LOG_INFO("Image prediction result is: id: %d", best_idx + 1); - output->result = &score; - output->len = sizeof(score); + *output_length = sizeof(score); return result; }
diff --git a/quant_models/iree_exec/mobilenet_v1.c b/quant_models/iree_exec/mobilenet_v1.c index 33f6352..9394637 100644 --- a/quant_models/iree_exec/mobilenet_v1.c +++ b/quant_models/iree_exec/mobilenet_v1.c
@@ -70,7 +70,7 @@ iree_status_t process_output(const MlModel *model, iree_hal_buffer_mapping_t *buffers, - MlOutput *output) { + uint32_t *output_length) { iree_status_t result = iree_ok_status(); // find the label index with best prediction int best_out = 0; @@ -87,7 +87,6 @@ LOG_INFO("Image prediction result is: id: %d", best_idx + 1); - output->result = &score; - output->len = sizeof(score); + *output_length = sizeof(score); return result; }
diff --git a/quant_models/iree_exec/mobilenet_v2.c b/quant_models/iree_exec/mobilenet_v2.c index a3e70f4..e2d342a 100644 --- a/quant_models/iree_exec/mobilenet_v2.c +++ b/quant_models/iree_exec/mobilenet_v2.c
@@ -70,7 +70,7 @@ iree_status_t process_output(const MlModel *model, iree_hal_buffer_mapping_t *buffers, - MlOutput *output) { + uint32_t *output_length) { iree_status_t result = iree_ok_status(); // find the label index with best prediction int best_out = 0; @@ -87,7 +87,6 @@ LOG_INFO("Image prediction result is: id: %d", best_idx + 1); - output->result = &score; - output->len = sizeof(score); + *output_length = sizeof(score); return result; }
diff --git a/quant_models/iree_exec/person_detection.c b/quant_models/iree_exec/person_detection.c index 759b82f..6d96146 100644 --- a/quant_models/iree_exec/person_detection.c +++ b/quant_models/iree_exec/person_detection.c
@@ -70,7 +70,7 @@ iree_status_t process_output(const MlModel *model, iree_hal_buffer_mapping_t *buffers, - MlOutput *output) { + uint32_t *output_length) { iree_status_t result = iree_ok_status(); int8_t *data = (int8_t *)buffers[0].contents.data; detection.non_person_score = data[0]; @@ -78,8 +78,7 @@ LOG_INFO("Output: Non-person Score: %d; Person Score: %d", detection.non_person_score, detection.person_score); - output->result = &detection; - output->len = sizeof(detection); + *output_length = sizeof(detection); return result; }