tflite_flutter_plugin icon indicating copy to clipboard operation
tflite_flutter_plugin copied to clipboard

[Question] How to check if a certain backend is available?

Open CaptainDario opened this issue 3 years ago • 1 comments

How can one check if a certain backend is available on the current device?

For example, not all android devices support the GPU delegate, when used anyways, the app crashes. Therefore I am interested in a way to check which backends are available on the current device.

CaptainDario avatar Mar 02 '22 17:03 CaptainDario

Some progress: For NNAPI you can simply check if the android SDK version is >= 27 (docs about this).

example:

// use NNAPI on android if android API >= 27
if (androidInfo.version.sdkInt! >= 27) {
  interpreter = await _nnapiInterpreter();
}

CaptainDario avatar Mar 13 '22 16:03 CaptainDario