#[repr(C)]pub struct TfLiteDelegate {
pub data_: *mut c_void,
pub Prepare: Option<unsafe extern "C" fn(context: *mut TfLiteContext, delegate: *mut TfLiteDelegate) -> TfLiteStatus>,
pub CopyFromBufferHandle: Option<unsafe extern "C" fn(context: *mut TfLiteContext, delegate: *mut TfLiteDelegate, buffer_handle: TfLiteBufferHandle, tensor: *mut TfLiteTensor) -> TfLiteStatus>,
pub CopyToBufferHandle: Option<unsafe extern "C" fn(context: *mut TfLiteContext, delegate: *mut TfLiteDelegate, buffer_handle: TfLiteBufferHandle, tensor: *mut TfLiteTensor) -> TfLiteStatus>,
pub FreeBufferHandle: Option<unsafe extern "C" fn(context: *mut TfLiteContext, delegate: *mut TfLiteDelegate, handle: *mut TfLiteBufferHandle)>,
pub flags: i64,
pub opaque_delegate_builder: *mut TfLiteOpaqueDelegateBuilder,
}Expand description
WARNING: This is an experimental interface that is subject to change.
Fields§
§data_: *mut c_voidData 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.
Prepare: Option<unsafe extern "C" fn(context: *mut TfLiteContext, delegate: *mut TfLiteDelegate) -> TfLiteStatus>Invoked by ModifyGraphWithDelegate. 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.
CopyFromBufferHandle: Option<unsafe extern "C" fn(context: *mut TfLiteContext, delegate: *mut TfLiteDelegate, buffer_handle: TfLiteBufferHandle, tensor: *mut TfLiteTensor) -> TfLiteStatus>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.
CopyToBufferHandle: Option<unsafe extern "C" fn(context: *mut TfLiteContext, delegate: *mut TfLiteDelegate, buffer_handle: TfLiteBufferHandle, tensor: *mut TfLiteTensor) -> TfLiteStatus>Copy the data from raw memory of the given tensor to delegate buffer
handle. This can be null if the delegate doesn’t use its own buffer.
FreeBufferHandle: Option<unsafe extern "C" fn(context: *mut TfLiteContext, delegate: *mut TfLiteDelegate, handle: *mut TfLiteBufferHandle)>Free the Delegate Buffer Handle. 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.
flags: i64Bitmask flags. See the comments in TfLiteDelegateFlags.
opaque_delegate_builder: *mut TfLiteOpaqueDelegateBuilderThe 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.
Trait Implementations§
Source§impl Clone for TfLiteDelegate
impl Clone for TfLiteDelegate
Source§fn clone(&self) -> TfLiteDelegate
fn clone(&self) -> TfLiteDelegate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more