ArmNN
 24.02
tflite Namespace Reference

Functions

TfLiteDelegate * tflite_plugin_create_delegate (char **options_keys, char **options_values, size_t num_options, void(*report_error)(const char *))
 This file defines two symbols that need to be exported to use the TFLite external delegate provider. More...
 
void tflite_plugin_destroy_delegate (TfLiteDelegate *delegate)
 Destroy a given delegate plugin. More...
 

Function Documentation

◆ tflite_plugin_create_delegate()

TfLiteDelegate* tflite::tflite_plugin_create_delegate ( char **  options_keys,
char **  options_values,
size_t  num_options,
void(*)(const char *)  report_error 
)

This file defines two symbols that need to be exported to use the TFLite external delegate provider.

This is a plugin that can be used for fast integration of delegates into benchmark tests and other tools. It allows loading of a dynamic delegate library at runtime.

The external delegate also has Tensorflow Lite Python bindings. Therefore the dynamic external delegate can be directly used with Tensorflow Lite Python APIs.

See tensorflow/lite/delegates/external for details or visit the tensorflow guide here Implementation of the TfLite external delegate plugin

For details about what options_keys and option_values are supported please see: armnnDelegate::DelegateOptions::DelegateOptions(char const* const*, char const* const*,size_t,void (*)(const char*))

Definition at line 36 of file armnn_external_delegate.cpp.

40 {
41  // Returning null indicates an error during delegate creation, we initialize with that
42  TfLiteDelegate* delegate = nullptr;
43  try
44  {
45  armnnDelegate::DelegateOptions options (options_keys, options_values, num_options, (*report_error));
46  delegate = TfLiteArmnnDelegateCreate(options);
47  }
48  catch (const std::exception& ex)
49  {
50  if(report_error)
51  {
52  report_error(ex.what());
53  }
54  }
55  return delegate;
56 }

References armnnDelegate::TfLiteArmnnDelegateCreate().

◆ tflite_plugin_destroy_delegate()

void tflite::tflite_plugin_destroy_delegate ( TfLiteDelegate *  delegate)

Destroy a given delegate plugin.

Parameters
[in]delegateDelegate to destruct

Definition at line 62 of file armnn_external_delegate.cpp.

63 {
65 }

References armnnDelegate::TfLiteArmnnDelegateDelete().

armnnDelegate::TfLiteArmnnDelegateDelete
void TfLiteArmnnDelegateDelete(TfLiteDelegate *tfLiteDelegate)
armnnDelegate::TfLiteArmnnDelegateCreate
TfLiteDelegate * TfLiteArmnnDelegateCreate(armnnDelegate::DelegateOptions options)