tflite_flutter_plugin icon indicating copy to clipboard operation
tflite_flutter_plugin copied to clipboard

How to use the XNNPackDelegate

Open CaptainDario opened this issue 3 years ago • 3 comments

I am having trouble getting the XNNPackDelegate working.

I build the binary according to the docs.

and try to use the interpreter like:

    Interpreter interpreter;
    final options = InterpreterOptions()..addDelegate(
      XNNPackDelegate(
        options: XNNPackDelegateOptions(
          numThreads: 4 
        )
      )
    );
    interpreter = await Interpreter.fromAsset(
      _interpreterAssetPath,
      options: options
    );

However I always encounter the errror:

ArgumentError (Invalid argument(s): Failed to lookup symbol 'TfLiteXNNPackDelegateCreate': error code 2138089832)

Does anybody know how to solve this?

CaptainDario avatar Jan 25 '22 19:01 CaptainDario

Did you check if the TfLiteXNNPackDelegateCreate symbols is being exported correctly?

You may refer to these answers to check that:

  • https://stackoverflow.com/questions/1237575/how-do-i-find-out-what-all-symbols-are-exported-from-a-shared-object
  • https://stackoverflow.com/questions/34732/how-do-i-list-the-symbols-in-a-so-file

am15h avatar Mar 06 '22 11:03 am15h

I copied the binaries from the example. Are the binaries from there supposed to work?

Maybe you could also add the binaries for desktop platforms to the release section?

CaptainDario avatar Mar 06 '22 12:03 CaptainDario

I don't remember if these binaries were built with delegate support, you may refer to stackoverflow links to check exported symbols.

am15h avatar Mar 06 '22 12:03 am15h