Update NNAPI benchmark to use StatefulNNAPIDelegate am: f1ce746a59 am: f3d14b938c
am: 603ef8d7f3

Change-Id: I5895a282ea331694113316163421d4fdb4c5a64b
diff --git a/jni/run_tflite.cpp b/jni/run_tflite.cpp
index 5ca88a8..4e03b36 100644
--- a/jni/run_tflite.cpp
+++ b/jni/run_tflite.cpp
@@ -118,8 +118,10 @@
       __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Running NNAPI on device %s",
                           nnapi_device_name);
     }
-    if (mTfliteInterpreter->ModifyGraphWithDelegate(
-            tflite::NnApiDelegate(nnapi_device_name)) != kTfLiteOk) {
+    tflite::StatefulNnApiDelegate::Options nnapi_options;
+    nnapi_options.accelerator_name = nnapi_device_name;
+    mTfliteNnapiDelegate = std::make_unique<tflite::StatefulNnApiDelegate>(nnapi_options);
+    if (mTfliteInterpreter->ModifyGraphWithDelegate(mTfliteNnapiDelegate.get()) != kTfLiteOk) {
       __android_log_print(ANDROID_LOG_ERROR, LOG_TAG,
                           "Failed to initialize NNAPI Delegate");
       return false;
diff --git a/jni/run_tflite.h b/jni/run_tflite.h
index 4a533db..2119ab1 100644
--- a/jni/run_tflite.h
+++ b/jni/run_tflite.h
@@ -94,6 +94,7 @@
 
   std::unique_ptr<tflite::FlatBufferModel> mTfliteModel;
   std::unique_ptr<tflite::Interpreter> mTfliteInterpreter;
+  std::unique_ptr<tflite::StatefulNnApiDelegate> mTfliteNnapiDelegate;
   // Store indices of output tensors, used to dump intermediate tensors
   std::vector<int> outputs;
 };