TfLite Stay organized with collections Save and categorize content based on your preferences.
Page Summary
TfLite is the entry point for the TensorFlow Lite Java API provided by Google Play services.
You can utilize the Google Play services runtime for TFLite by initializing your InterpreterApi with
options.setRuntime(FROM_SYSTEM)oroptions.setRuntime(PREFER_SYSTEM_OVER_APPLICATION).Key static methods available include
getClientto get a TfLiteClient instance,getTfliteModuleAvailabilityStatusto check module availability, andinitialize(with or without options) to initialize the API.TFLite API methods should only be called after the initialization task has successfully completed.
Entry point for the TensorFlow Lite (TFLite) Java API provided by Google Play services.
Once the initialization has finished successfully, you can usethe regular Tensorflow Lite APIs. To benefit from the Google Play services runtime, remember to initialize yourInterpreterApi instance withoptions.setRuntime(FROM_SYSTEM) oroptions.setRuntime(PREFER_SYSTEM_OVER_APPLICATION).
For more information about this API, see theTensorFlow Lite guide.
Public Method Summary
| static TfLiteClient | getClient(Context context) Returns a TfLiteClient instance that can eventually be used as an argument forOptionalModuleApi. |
| static Task<Status> | getTfliteModuleAvailabilityStatus(Context context) Gets the availability status of the TFLite dynamite module. |
| static Task<Void> | initialize(Context context) Initializes the TFLite API with the default options (which are to disable loading the GPU delegate). |
| static Task<Void> | initialize(Context context, TfLiteInitializationOptions options) Initializes the TFLite API with the specified options. |
Inherited Method Summary
Public Methods
public static TfLiteClientgetClient(Context context)
Returns aTfLiteClient instance that can eventually be used as an argument forOptionalModuleApi.
public static Task<Status>getTfliteModuleAvailabilityStatus(Context context)
Gets the availability status of the TFLite dynamite module.
public static Task<Void>initialize(Context context)
Initializes the TFLite API with the default options (which are to disable loading the GPU delegate). TFLite API methods should only be called after the task returned by this method has successfully completed.
This method returns aTask<Void>, so you should wait for the task to be completed, but the return value of the Task is irrelevant.
public static Task<Void>initialize(Context context, TfLiteInitializationOptions options)
Initializes the TFLite API with the specified options. TFLite API methods should only be called after the task returned by this method has successfully completed.
This method returns aTask<Void>. Make sure to call TFLite API methods only after theTask has successfully completed. The return value of theTask, though, is irrelevant (will always benull).
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-18 UTC.