10 #include <tensorflow/lite/minimal_logging.h> 31 "gpu-kernel-profiling-enabled"};
117 char** options_values,
119 void (*report_error)(
const char*))
122 TfLiteDelegate* delegate =
nullptr;
128 for (
size_t i = 0; i < num_options; ++i)
131 if (std::string(options_keys[i]) == std::string(
"backends"))
134 std::vector<armnn::BackendId> backends;
136 pch = strtok(options_values[i],
",");
139 backends.push_back(pch);
140 pch = strtok (NULL,
",");
145 else if (std::string(options_keys[i]) == std::string(
"logging-severity"))
150 else if (std::string(options_keys[i]) == std::string(
"gpu-tuning-level"))
155 else if (std::string(options_keys[i]) == std::string(
"gpu-mlgo-tuning-file"))
160 else if (std::string(options_keys[i]) == std::string(
"gpu-tuning-file"))
165 else if (std::string(options_keys[i]) == std::string(
"gpu-kernel-profiling-enabled"))
170 else if (std::string(options_keys[i]) == std::string(
"save-cached-network"))
175 else if (std::string(options_keys[i]) == std::string(
"cached-network-filepath"))
181 else if (std::string(options_keys[i]) == std::string(
"enable-fast-math"))
190 else if (std::string(options_keys[i]) == std::string(
"number-of-threads"))
197 else if (std::string(options_keys[i]) == std::string(
"reduce-fp32-to-fp16"))
202 else if (std::string(options_keys[i]) == std::string(
"reduce-fp32-to-bf16"))
207 else if (std::string(options_keys[i]) == std::string(
"debug-data"))
209 optimizerOptions.
m_Debug = *options_values[i] !=
'0';
212 else if (std::string(options_keys[i]) == std::string(
"memory-import"))
218 throw armnn::Exception(
"Unknown option for the ArmNN Delegate given: " + std::string(options_keys[i]));
224 catch (
const std::exception& ex)
228 report_error(ex.what());
ModelOptions m_ModelOptions
TfLiteDelegate * tflite_plugin_create_delegate(char **options_keys, char **options_values, size_t num_options, void(*report_error)(const char *))
Create an ArmNN delegate plugin.
std::vector< std::string > gpu_options
This file defines two symbols that need to be exported to use the TFLite external delegate provider...
void SetLoggingSeverity(const armnn::LogSeverity &level)
Sets the severity level for logging within ArmNN that will be used on creation of the delegate...
Struct for the users to pass backend specific options.
TfLiteDelegate * TfLiteArmnnDelegateCreate(armnnDelegate::DelegateOptions options)
Base class for all ArmNN exceptions so that users can filter to just those.
void SetBackends(const std::vector< armnn::BackendId > &backends)
void TfLiteArmnnDelegateDelete(TfLiteDelegate *tfLiteDelegate)
DelegateOptions TfLiteArmnnDelegateOptionsDefault()
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
void AddBackendOption(const armnn::BackendOptions &option)
Appends a backend option to the list of backend options.
void SetOptimizerOptions(const armnn::OptimizerOptions &optimizerOptions)
void tflite_plugin_destroy_delegate(TfLiteDelegate *delegate)
Destroy a given delegate plugin.