Mbështjellës për një delegat vendas të TensorFlow Lite.
Nëse një implementim i deleguar ka burime ose memorie shtesë që duhet të lirohen në mënyrë eksplicite, atëherë praktika më e mirë është të shtoni një metodë close() në implementim dhe t'i bëni klientit ta thërrasë atë në mënyrë eksplicite kur shembulli i deleguar nuk është më në përdorim. Ndërsa kjo qasje teknikisht lejon ndarjen e një shembulli të vetëm të deleguar nëpër instanca të shumta përkthyes, zbatimi i deleguar duhet ta mbështesë në mënyrë eksplicite këtë.
Kthen një dorezë origjinale në zbatimin e delegatit TensorFlow Lite.
Metodat e trashëguara
Nga ndërfaqja java.io.Closeable
zbrazëti abstrakte
mbyll ()
Nga ndërfaqja java.lang.AutoCloseable
zbrazëti abstrakte
mbyll ()
Metodat publike
mbylljeboshllëku publik()
Mbyll delegatin dhe liron çdo burim që lidhet me të.
Ndryshe nga metoda e deklaruar në ndërfaqen bazë Closeable , kjo metodë nuk hedh përjashtime të kontrolluara.
abstrakt publik i gjatëgetNativeHandle()
Kthen një dorezë origjinale në zbatimin e delegatit TensorFlow Lite.
Shënim: Delegate Java ruan pronësinë e shembullit të delegatit vendas dhe duhet të sigurojë ekzistencën e tij për kohëzgjatjen e përdorimit me çdo shembull InterpreterApi .
Shënim: shembulli vendas i delegatit nuk mund të krijohet derisa delegati të jetë bashkangjitur me një përkthyes, kështu që kjo metodë nuk duhet të thirret derisa të jetë ndërtuar një përkthyes me këtë delegat.
Kthimet
Doreza e delegatit vendas. Në C/C++, ky duhet të jetë një tregues për 'TfLiteOpaqueDelegate'.
[[["E lehtë për t'u kuptuar","easyToUnderstand","thumb-up"],["E zgjidhi problemin tim","solvedMyProblem","thumb-up"],["Tjetër","otherUp","thumb-up"]],[["Mungojnë informacionet që më nevojiten","missingTheInformationINeed","thumb-down"],["Shumë e ndërlikuar/shumë hapa","tooComplicatedTooManySteps","thumb-down"],["E papërditësuar","outOfDate","thumb-down"],["Problem përkthimi","translationIssue","thumb-down"],["Problem me kampionët/kodin","samplesCodeIssue","thumb-down"],["Tjetër","otherDown","thumb-down"]],["Përditësimi i fundit: 2025-07-25 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|-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|"]]