Moved to experimental api

This commit is contained in:
Fabio Di Domenico 2020-03-17 09:55:26 +02:00
parent 5ae1f6d934
commit b97023504c
6 changed files with 10 additions and 10 deletions

View File

@ -79,11 +79,6 @@ void TfLiteInterpreterOptionsSetNumThreads(TfLiteInterpreterOptions* options,
options->num_threads = num_threads;
}
void TfLiteInterpreterOptionsSetUseNNAPI(TfLiteInterpreterOptions* options,
bool enable) {
options->useNNAPI = enable;
}
void TfLiteInterpreterOptionsAddDelegate(TfLiteInterpreterOptions* options,
TfLiteDelegate* delegate) {
options->delegates.push_back(delegate);

View File

@ -120,10 +120,6 @@ TFL_CAPI_EXPORT extern void TfLiteInterpreterOptionsDelete(
TFL_CAPI_EXPORT extern void TfLiteInterpreterOptionsSetNumThreads(
TfLiteInterpreterOptions* options, int32_t num_threads);
// Enable or disable the NN API for the interpreter (true to enable).
TFL_CAPI_EXPORT extern void TfLiteInterpreterOptionsSetUseNNAPI(
TfLiteInterpreterOptions* options, bool enable);
// Adds a delegate to be applied during `TfLiteInterpreter` creation.
//
// If delegate application fails, interpreter creation will also fail with an

View File

@ -50,6 +50,11 @@ void TfLiteInterpreterOptionsAddCustomOp(TfLiteInterpreterOptions* options,
options->op_resolver.AddCustom(name, registration, min_version, max_version);
}
void TfLiteInterpreterOptionsSetUseNNAPI(TfLiteInterpreterOptions* options,
bool enable) {
options->useNNAPI = enable;
}
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -49,6 +49,10 @@ TFL_CAPI_EXPORT void TfLiteInterpreterOptionsAddCustomOp(
const TfLiteRegistration* registration, int32_t min_version,
int32_t max_version);
// Enable or disable the NN API for the interpreter (true to enable).
TFL_CAPI_EXPORT extern void TfLiteInterpreterOptionsSetUseNNAPI(
TfLiteInterpreterOptions* options, bool enable);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -41,6 +41,7 @@ TEST(CApiExperimentalTest, Smoke) {
TfLiteInterpreterOptions* options = TfLiteInterpreterOptionsCreate();
TfLiteInterpreterOptionsAddBuiltinOp(options, kTfLiteBuiltinAdd,
GetDummyRegistration(), 1, 1);
TfLiteInterpreterOptionsSetUseNNAPI(options, true);
TfLiteInterpreter* interpreter = TfLiteInterpreterCreate(model, options);
ASSERT_NE(interpreter, nullptr);

View File

@ -38,7 +38,6 @@ TEST(CApiSimple, Smoke) {
TfLiteInterpreterOptions* options = TfLiteInterpreterOptionsCreate();
ASSERT_NE(options, nullptr);
TfLiteInterpreterOptionsSetNumThreads(options, 2);
TfLiteInterpreterOptionsSetUseNNAPI(options, true);
TfLiteInterpreter* interpreter = TfLiteInterpreterCreate(model, options);
ASSERT_NE(interpreter, nullptr);