TfLiteNative

public class TfLiteNative


Entry point for the TensorFlow Lite (TFLite) C API provided by Google Play services.

Once the initialization has finished successfully, you can use the regular Tensorflow Lite C APIs.

To build C or C++ code that uses the C API, include headers from the AAR containing this class and pass both -DTFLITE_IN_GMSCORE and -DTFLITE_WITH_STABLE_ABI options to the C (or C++) compiler.

Summary

Public methods

static TfLiteClient
getClient(Context context)

Returns a TfLiteClient instance that can eventually be used as an argument for com.google.android.gms.common.api.OptionalModuleApi.

static Task<Void>

Initializes the TFLite C API with the default options.

static Task<Void>

Initializes the TFLite C/C++ API with the specified options.

Public methods

getClient

public static TfLiteClient getClient(Context context)

Returns a TfLiteClient instance that can eventually be used as an argument for com.google.android.gms.common.api.OptionalModuleApi. See the Module Install APIs.

initialize

public static Task<Void> initialize(Context context)

Initializes the TFLite C API with the default options. TFLite C API functions should only be called after the task returned by this method has successfully completed.

This method returns a Task<Void>, so you should wait for the task to be completed, but the return value of the Task is irrelevant.

initialize

public static Task<Void> initialize(Context context, TfLiteInitializationOptions options)

Initializes the TFLite C/C++ API with the specified options. TFLite C/C++ API functions/methods should only be called after the task returned by this method has successfully completed.

This method returns a Task<Void>. Make sure to call TFLite API methods only after the Task has successfully completed. The return value of the Task, though, is irrelevant (will always be null).