Files
tensorflow--tensorflow/tensorflow/lite/delegates/external
wehub-resource-sync 8a852e4b4e
cffconvert / validate (push) Has been skipped
License Check / license-check (push) Failing after 2s
chore: import upstream snapshot with attribution
2026-07-13 12:14:16 +08:00
..

What is an External Delegate?

An external delegate is a special Tensorflow Lite delegate that is simply initialized from loading a dynamic library which encapsulates an actual Tensorflow Lite delegate implementation. The actual delegate exposes the following two creation and deletion C APIs:

  • tflite_plugin_create_delegate (declaration seen below) creates a delegate object based on provided key-value options. It may return NULL to indicate an error with the detailed information reported by calling report_error if provided. Each option key and value should be null-terminated.
TfLiteDelegate* tflite_plugin_create_delegate(
  char** options_keys, char** options_values, size_t num_options,
  void (*report_error)(const char *))
  • tflite_plugin_destroy_delegate (declaration seen below) destroys the delegate object that is created by the previous API. NULL as an argument value is allowed.
void tflite_plugin_destroy_delegate(TfLiteDelegate* delegate)

The external delegate provides an opaque and transparent way to utilize a Tensorflow Lite delegate when performing inference. In other words, one may replace the actual Tensorflow Lite delegate by simply updating the dynamic library without changing the application code. We developed this mainly for delegate evaluation.

Note, this delegate is the corresponding C++ implementation to the one for Tensorflow Lite Python binding as shown here.