[lite] Update the label_image example to use StatefulNnApiDelegate.
This changes the behaviour when the '--accelerated' flag is enabled to use acceleration via StatefulNnApiDelegate, which is not deprecated, rather than via NnApiDelegate, which is deprecated. It also sets the allow_fp16 field in the StatementNnApiDelegate::options to the appropriate value based on the setting of the --allow_fp16 flag. PiperOrigin-RevId: 333695351 Change-Id: I3917ff8f79f73323635bb79f4af22df96f4ec655
This commit is contained in:
parent
ecd0749667
commit
f870dba9d4
tensorflow/lite
@ -86,7 +86,9 @@ TfLiteDelegatePtrMap GetDelegates(Settings* s) {
|
||||
}
|
||||
|
||||
if (s->accel) {
|
||||
auto delegate = evaluation::CreateNNAPIDelegate();
|
||||
StatefulNnApiDelegate::Options options;
|
||||
options.allow_fp16 = s->allow_fp16;
|
||||
auto delegate = evaluation::CreateNNAPIDelegate(options);
|
||||
if (!delegate) {
|
||||
LOG(INFO) << "NNAPI acceleration is unsupported on this platform.\n";
|
||||
} else {
|
||||
|
@ -25,11 +25,12 @@ limitations under the License.
|
||||
#define TFLITE_SUPPORTS_GPU_DELEGATE 1
|
||||
#endif
|
||||
|
||||
#include "tensorflow/lite/delegates/nnapi/nnapi_delegate.h"
|
||||
|
||||
#if TFLITE_SUPPORTS_GPU_DELEGATE
|
||||
#include "tensorflow/lite/delegates/gpu/delegate.h"
|
||||
#endif
|
||||
|
||||
#include "tensorflow/lite/delegates/nnapi/nnapi_delegate.h"
|
||||
#if defined(__ANDROID__) && (defined(__arm__) || defined(__aarch64__))
|
||||
#include "tensorflow/lite/delegates/hexagon/hexagon_delegate.h"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user