Copy the data from delegate buffer handle into raw memory of the given tensor.
Note that the delegate is allowed to allocate the raw bytes as long as it follows the rules for kTfLiteDynamic tensors, in which case this cannot be null.
Note: This only frees the handle, but this doesn't release the underlying resource (e.g. textures). The resources are either owned by application layer or the delegate. This can be null if the delegate doesn't use its own buffer.
This prepare is called, giving the delegate a view of the current graph through TfLiteContext*. It typically will look at the nodes and call ReplaceNodeSubsetsWithDelegateKernels() to ask the TensorFlow lite runtime to create macro-nodes to represent delegated subgraphs of the original graph.
data_
void * TfLiteDelegate::data_
Data that delegate needs to identify itself.
This data is owned by the delegate. The delegate is owned in the user code, so the delegate is responsible for deallocating this when it is destroyed.
flags
int64_t TfLiteDelegate::flags
Bitmask flags. See the comments in TfLiteDelegateFlags.
The opaque delegate builder associated with this object.
If set then the TF Lite runtime will give precedence to this field. E.g. instead of invoking Prepare via the function pointer inside the TfLiteDelegate object, the runtime will first check if the corresponding function pointer inside opaque_delegate_builder is set and if so invoke that.
If this field is non-null, then the Prepare field (of the TfLiteDelegate) should be null.
[[["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-05-10 UTC."],[],[],null,["# TfLiteDelegate Struct Reference\n\nTfLiteDelegate\n==============\n\n\n`#include \u003ccommon.h\u003e`\n\nWARNING: This is an experimental interface that is subject to change.\n\nSummary\n-------\n\n| ### Public attributes ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [CopyFromBufferHandle](#struct_tf_lite_delegate_1a4fee5ac7e1ba441d4c364c323930c8d3)`)(TfLiteContext *context, struct TfLiteDelegate *delegate, TfLiteBufferHandle buffer_handle, TfLiteTensor *tensor)` | `TfLiteStatus(*` Copy the data from delegate buffer handle into raw memory of the given `tensor`. |\n| [CopyToBufferHandle](#struct_tf_lite_delegate_1a94f6b1d6e2c16a2e9944012a93f5e70d)`)(TfLiteContext *context, struct TfLiteDelegate *delegate, TfLiteBufferHandle buffer_handle, TfLiteTensor *tensor)` | `TfLiteStatus(*` Copy the data from raw memory of the given `tensor` to delegate buffer handle. |\n| [FreeBufferHandle](#struct_tf_lite_delegate_1a66da14187ba32cbfd8e65f5b06d7c0ea)`)(TfLiteContext *context, struct TfLiteDelegate *delegate, TfLiteBufferHandle *handle)` | `void(*` Free the Delegate Buffer Handle. |\n| [Prepare](#struct_tf_lite_delegate_1aa5f8c5a4ceb1bfb26c4d33a33d2afd3a)`)(TfLiteContext *context, struct TfLiteDelegate *delegate)` | `TfLiteStatus(*` Invoked by `ModifyGraphWithDelegate`. |\n| [data_](#struct_tf_lite_delegate_1a90d8880e87c24835171a14eff0a22d98) | `void *` Data that delegate needs to identify itself. |\n| [flags](#struct_tf_lite_delegate_1a4c32a68d8020c616f31338a048f055c5) | `int64_t` Bitmask flags. See the comments in `TfLiteDelegateFlags`. |\n| [opaque_delegate_builder](#struct_tf_lite_delegate_1a5a0db5f3d47c3a069c9b1d6dc7326e0e) | `struct `[TfLiteOpaqueDelegateBuilder](/edge/api/tflite/c/struct/tf-lite-opaque-delegate-builder#struct_tf_lite_opaque_delegate_builder)` *` The opaque delegate builder associated with this object. |\n\nPublic attributes\n-----------------\n\n### CopyFromBufferHandle\n\n```scdoc\nTfLiteStatus(* TfLiteDelegate::CopyFromBufferHandle)(TfLiteContext *context, struct TfLiteDelegate *delegate, TfLiteBufferHandle buffer_handle, TfLiteTensor *tensor)\n``` \nCopy the data from delegate buffer handle into raw memory of the given `tensor`.\n\nNote that the delegate is allowed to allocate the raw bytes as long as it follows the rules for `kTfLiteDynamic` tensors, in which case this cannot be null. \n\n### CopyToBufferHandle\n\n```scdoc\nTfLiteStatus(* TfLiteDelegate::CopyToBufferHandle)(TfLiteContext *context, struct TfLiteDelegate *delegate, TfLiteBufferHandle buffer_handle, TfLiteTensor *tensor)\n``` \nCopy the data from raw memory of the given `tensor` to delegate buffer handle.\n\nThis can be null if the delegate doesn't use its own buffer. \n\n### FreeBufferHandle\n\n```scdoc\nvoid(* TfLiteDelegate::FreeBufferHandle)(TfLiteContext *context, struct TfLiteDelegate *delegate, TfLiteBufferHandle *handle)\n``` \nFree the Delegate Buffer Handle.\n\nNote: This only frees the handle, but this doesn't release the underlying resource (e.g. textures). The resources are either owned by application layer or the delegate. This can be null if the delegate doesn't use its own buffer. \n\n### Prepare\n\n```scdoc\nTfLiteStatus(* TfLiteDelegate::Prepare)(TfLiteContext *context, struct TfLiteDelegate *delegate)\n``` \nInvoked by `ModifyGraphWithDelegate`.\n\nThis prepare is called, giving the delegate a view of the current graph through `TfLiteContext*`. It typically will look at the nodes and call `ReplaceNodeSubsetsWithDelegateKernels()` to ask the TensorFlow lite runtime to create macro-nodes to represent delegated subgraphs of the original graph. \n\n### data_\n\n```scdoc\nvoid * TfLiteDelegate::data_\n``` \nData that delegate needs to identify itself.\n\nThis data is owned by the delegate. The delegate is owned in the user code, so the delegate is responsible for deallocating this when it is destroyed. \n\n### flags\n\n```scdoc\nint64_t TfLiteDelegate::flags\n``` \nBitmask flags. See the comments in `TfLiteDelegateFlags`. \n\n### opaque_delegate_builder\n\n```scdoc\nstruct TfLiteOpaqueDelegateBuilder * TfLiteDelegate::opaque_delegate_builder\n``` \nThe opaque delegate builder associated with this object.\n\nIf set then the TF Lite runtime will give precedence to this field. E.g. instead of invoking `Prepare` via the function pointer inside the [TfLiteDelegate](/edge/api/tflite/c/struct/tf-lite-delegate#struct_tf_lite_delegate) object, the runtime will first check if the corresponding function pointer inside `opaque_delegate_builder` is set and if so invoke that.\n\nIf this field is non-null, then the `Prepare` field (of the [TfLiteDelegate](/edge/api/tflite/c/struct/tf-lite-delegate#struct_tf_lite_delegate)) should be null."]]