TfLiteGpu
Stay organized with collections
Save and categorize content based on your preferences.
Helper class for GPU delegate support in TensorFlow Lite (TFLite) for Google Play
services.
The GPU delegate is not supported on all Android devices, due to differences in available
OpenGL versions, driver features, and device resources. This class provides information on
whether the GPU delegate is suitable for the current device.
Inherited Method Summary
From class java.lang.Object
Public Methods
public static Task<Status>
getGpuDelegateAvailabilityStatus
( Context
context)
Gets the availability status of the TFLite GPU delegate module.
public static Task< Boolean
>
isGpuDelegateAvailable
( Context
context)
Returns whether the GPU delegate is supported on this device.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-18 UTC."],[[["\u003cp\u003e\u003ccode\u003eTfLiteGpu\u003c/code\u003e is a helper class that facilitates GPU delegate support in TensorFlow Lite for Google Play services on Android.\u003c/p\u003e\n"],["\u003cp\u003eGPU delegate availability varies across Android devices due to differences in OpenGL versions, driver features, and device resources; \u003ccode\u003eTfLiteGpu\u003c/code\u003e helps determine suitability.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eTfLiteGpu\u003c/code\u003e provides methods to check for GPU delegate availability and obtain a \u003ccode\u003eTfLiteGpuClient\u003c/code\u003e for interaction with the delegate through the \u003ccode\u003eOptionalModuleApi\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `TfLiteGpu` class facilitates GPU delegate support in TensorFlow Lite for Google Play services. It determines if the GPU delegate is compatible with a device, considering OpenGL versions and driver features. Key actions include: retrieving a `TfLiteGpuClient` instance via `getClient`, obtaining the delegate's availability status using `getGpuDelegateAvailabilityStatus`, and checking for general GPU delegate support through `isGpuDelegateAvailable`. These methods take the current Android application `Context` as a parameter.\n"],null,["# TfLiteGpu\n\npublic class **TfLiteGpu** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nHelper class for GPU delegate support in TensorFlow Lite (TFLite) for Google Play\nservices.\n\nThe GPU delegate is not supported on all Android devices, due to differences in available\nOpenGL versions, driver features, and device resources. This class provides information on\nwhether the GPU delegate is suitable for the current device. \n\n### Public Method Summary\n\n|--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [TfLiteGpuClient](/android/reference/com/google/android/gms/tflite/gpu/support/TfLiteGpuClient) | [getClient](/android/reference/com/google/android/gms/tflite/gpu/support/TfLiteGpu#getClient(android.content.Context))([Context](//developer.android.com/reference/android/content/Context.html) context) Returns a [TfLiteGpuClient](/android/reference/com/google/android/gms/tflite/gpu/support/TfLiteGpuClient) instance that can eventually be used as an argument for [OptionalModuleApi](/android/reference/com/google/android/gms/common/api/OptionalModuleApi). |\n| static Task\\\u003cStatus\\\u003e | [getGpuDelegateAvailabilityStatus](/android/reference/com/google/android/gms/tflite/gpu/support/TfLiteGpu#getGpuDelegateAvailabilityStatus(android.content.Context))([Context](//developer.android.com/reference/android/content/Context.html) context) Gets the availability status of the TFLite GPU delegate module. |\n| static Task\\\u003c[Boolean](//developer.android.com/reference/java/lang/Boolean.html)\\\u003e | [isGpuDelegateAvailable](/android/reference/com/google/android/gms/tflite/gpu/support/TfLiteGpu#isGpuDelegateAvailable(android.content.Context))([Context](//developer.android.com/reference/android/content/Context.html) context) Returns whether the GPU delegate is supported on this device. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public static [TfLiteGpuClient](/android/reference/com/google/android/gms/tflite/gpu/support/TfLiteGpuClient)\n**getClient** ([Context](//developer.android.com/reference/android/content/Context.html) context)\n\nReturns a [TfLiteGpuClient](/android/reference/com/google/android/gms/tflite/gpu/support/TfLiteGpuClient)\ninstance that can eventually be used as an argument for [OptionalModuleApi](/android/reference/com/google/android/gms/common/api/OptionalModuleApi). \n\n#### public static Task\\\u003cStatus\\\u003e\n**getGpuDelegateAvailabilityStatus** ([Context](//developer.android.com/reference/android/content/Context.html) context)\n\nGets the availability status of the TFLite GPU delegate module. \n\n#### public static Task\\\u003c[Boolean](//developer.android.com/reference/java/lang/Boolean.html)\\\u003e\n**isGpuDelegateAvailable** ([Context](//developer.android.com/reference/android/content/Context.html) context)\n\nReturns whether the GPU delegate is supported on this device."]]