aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMåns Nilsson <mans.nilsson@arm.com>2023-04-04 16:39:42 +0200
committerMåns Nilsson <mans.nilsson@arm.com>2023-04-04 17:50:03 +0200
commitc23c4e135b8982904b300feadbbd96fbf293398f (patch)
tree0f060fbc5bb5aba25bf87abe6c98c792e2cc8fcf
parentf1dada304a552cc19d27d0506d16040ff787c0c1 (diff)
downloadethos-u-core-software-c23c4e135b8982904b300feadbbd96fbf293398f.tar.gz
Inference app: Call external context after allocate tensors
TFLM now mandates to set external context during prepare or invoke state. Change-Id: I87d3f386aac5c47b71a7abfb9a8c48ff0255fc67
-rw-r--r--applications/inference_process/src/inference_process.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/applications/inference_process/src/inference_process.cpp b/applications/inference_process/src/inference_process.cpp
index a5bf642..3cbc8e0 100644
--- a/applications/inference_process/src/inference_process.cpp
+++ b/applications/inference_process/src/inference_process.cpp
@@ -158,11 +158,6 @@ bool InferenceProcess::runJob(InferenceJob &job) {
tflite::ArmProfiler profiler;
tflite::MicroInterpreter interpreter(model, resolver, tensorArena, tensorArenaSize, nullptr, &profiler);
- // Set external context
- if (job.externalContext != nullptr) {
- interpreter.SetMicroExternalContext(job.externalContext);
- }
-
// Allocate tensors
TfLiteStatus status = interpreter.AllocateTensors();
if (status != kTfLiteOk) {
@@ -170,6 +165,11 @@ bool InferenceProcess::runJob(InferenceJob &job) {
return true;
}
+ // Set external context
+ if (job.externalContext != nullptr) {
+ interpreter.SetMicroExternalContext(job.externalContext);
+ }
+
// Copy IFM data from job descriptor to TFLu arena
if (copyIfm(job, interpreter)) {
return true;