Yerel TensorFlow Lite Temsilcisi için sarmalayıcı.
Yetki verilen bir uygulama, açıkça serbest bırakılması gereken ek kaynaklar veya bellek barındırıyorsa en iyi uygulama, uygulamaya bir close() yöntemi eklemek ve yetki verilen örnek artık kullanılmadığında istemcinin bunu açıkça çağırmasını sağlamaktır. Bu yaklaşım teknik olarak tek bir temsilcili örneğin birden fazla yorumlayıcı örneği arasında paylaşılmasına izin verse de temsilci uygulaması bunu açıkça desteklemelidir.
TensorFlow Lite yetki veren uygulamasına yerel bir herkese açık kullanıcı adı döndürür.
Devralınan Yöntemler
java.io.Closeable arayüzünden
soyut
geçersiz
close()
java.lang.AutoCloseable arayüzünden
soyut
geçersiz
close()
Herkese Açık Yöntemler
herkese açık
void
close()
Yetki verilmiş kullanıcıyı kapatır ve onunla ilişkili tüm kaynakları serbest bırakır.
Temel Closeable arayüzünde açıklanan yöntemin tersine, bu yöntem işaretli istisnalar atmaz.
herkese açık
soyut
uzun
getNativeHandle()
TensorFlow Lite yetki veren uygulamasına yerel bir herkese açık kullanıcı adı döndürür.
Not: Java Delegate, yerel temsilci örneğinin sahipliğini korur ve herhangi bir InterpreterApi örneğinde kullanım süresi boyunca var olmaya devam etmesi gerekir.
Not: Yetki verilmiş kullanıcı bir yorumlayıcıya eklenene kadar yerel temsilci örneği oluşturulamaz. Bu nedenle, bu yöntem, bu yetki verilmiş kullanıcı ile bir çevirmen oluşturulana kadar çağrılmamalıdır.
İlerlemeler
Yerel yetki verilmiş kullanıcı adı. C/C++'da bu, "TfLiteOpaqueDelegate"
işaretçisi olmalıdır.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-07-24 UTC."],[],[],null,["# Delegate\n\npublic interface **Delegate** \n\n|---|---|---|\n| Known Indirect Subclasses [GpuDelegate](/edge/api/tflite/java/org/tensorflow/lite/gpu/GpuDelegate) |--------------------------------------------------------------------------|-----------------------------------------------------------------------------------| | [GpuDelegate](/edge/api/tflite/java/org/tensorflow/lite/gpu/GpuDelegate) | [Delegate](/edge/api/tflite/java/org/tensorflow/lite/Delegate) for GPU inference. | |||\n\nWrapper for a native TensorFlow Lite Delegate.\n\nIf a delegate implementation holds additional resources or memory that should be explicitly\nfreed, then best practice is to add a `close()` method to the implementation and have the\nclient call that explicitly when the delegate instance is no longer in use. While this approach\ntechnically allows sharing of a single delegate instance across multiple interpreter instances,\nthe delegate implementation must explicitly support this.\n\n\u003cbr /\u003e\n\n### Public Methods\n\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| void | [close](/edge/api/tflite/java/org/tensorflow/lite/Delegate#close())() Closes the delegate and releases any resources associated with it. |\n| abstract long | [getNativeHandle](/edge/api/tflite/java/org/tensorflow/lite/Delegate#getNativeHandle())() Returns a native handle to the TensorFlow Lite delegate implementation. |\n\n### Inherited Methods\n\nFrom interface java.io.Closeable \n\n|---------------|---------|\n| abstract void | close() |\n\nFrom interface java.lang.AutoCloseable \n\n|---------------|---------|\n| abstract void | close() |\n\nPublic Methods\n--------------\n\n#### public void\n**close**\n()\n\nCloses the delegate and releases any resources associated with it.\n\nIn contrast to the method declared in the base [Closeable](https://developer.android.com/reference/java/io/Closeable.html) interface, this method\ndoes not throw checked exceptions.\n\n\u003cbr /\u003e\n\n#### public abstract long\n**getNativeHandle**\n()\n\nReturns a native handle to the TensorFlow Lite delegate implementation.\n\nNote: The Java [Delegate](/edge/api/tflite/java/org/tensorflow/lite/Delegate) maintains ownership of the native delegate instance, and\nmust ensure its existence for the duration of usage with any [InterpreterApi](/edge/api/tflite/java/org/tensorflow/lite/InterpreterApi) instance.\n\nNote: the native delegate instance may not be created until the delegate has been attached\nto an interpreter, so this method should not be called until after an interpreter has been\nconstructed with this delegate.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n##### Returns\n\n- The native delegate handle. In C/C++, this should be a pointer to 'TfLiteOpaqueDelegate'. \n\n##### Throws\n\n| [IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html) | if called before the native delegate instance has been constructed. |\n|-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|"]]