@Properties(inherit=tensorflowlite.class) public class TfLiteContext extends Pointer
TfLiteContext
allows an op to access the tensors.
TfLiteContext
is a struct that is created by the TF Lite runtime
and passed to the "methods" (C function pointers) in the
TfLiteRegistration
struct that are used to define custom ops and custom
delegate kernels. It contains information and methods (C function pointers)
that can be called by the code implementing a custom op or a custom delegate
kernel. These methods provide access to the context in which that custom op
or custom delegate kernel occurs, such as access to the input and output
tensors for that op, as well as methods for allocating memory buffers
and intermediate tensors, etc.
See also TfLiteOpaqueContext
, which is an more ABI-stable equivalent.Modifier and Type | Class and Description |
---|---|
static class |
TfLiteContext.AcquireSubgraphContext_TfLiteContext_int_PointerPointer
Retrieves the corresponding TfLiteContext of a subgraph that the given
subgraph_index points to and switches to the delegate context for that
subgraph.
|
static class |
TfLiteContext.AddTensors_TfLiteContext_int_IntPointer
Add
tensors_to_add tensors, preserving pre-existing Tensor entries. |
static class |
TfLiteContext.AllocateBufferForEval_TfLiteContext_long_PointerPointer
Allocate a buffer which will be deallocated right after invoke phase.
|
static class |
TfLiteContext.AllocatePersistentBuffer_TfLiteContext_long
Allocate persistent buffer which has the same life time as the
interpreter.
|
static class |
TfLiteContext.GetEvalTensor_TfLiteContext_int
Returns a TfLiteEvalTensor struct for a given index.
|
static class |
TfLiteContext.GetExecutionPlan_TfLiteContext_PointerPointer
The execution plan contains a list of the node indices in execution
order.
|
static class |
TfLiteContext.GetExternalContext_TfLiteContext_int
Access external contexts by type.
|
static class |
TfLiteContext.GetModelMetadata_TfLiteContext_BytePointer_PointerPointer_SizeTPointer
Retrieves named metadata buffer from the TFLite model.
|
static class |
TfLiteContext.GetNodeAndRegistration_TfLiteContext_int_PointerPointer_PointerPointer
Get a Tensor node by node_index.
|
static class |
TfLiteContext.GetScratchBuffer_TfLiteContext_int
Get the scratch buffer pointer.
|
static class |
TfLiteContext.GetTensor_TfLiteContext_int
Returns a TfLiteTensor struct for a given index.
|
static class |
TfLiteContext.PreviewDelegatePartitioning_TfLiteContext_TfLiteIntArray_PointerPointer_IntPointer
This method provides a preview of post-delegation partitioning.
|
static class |
TfLiteContext.ReleaseSubgraphContext_TfLiteContext_int
Releases the subgraph context by switching back to the TFLite kernel
context for the subgraph that the given subgraph_index points to.
|
static class |
TfLiteContext.ReplaceNodeSubsetsWithDelegateKernels_TfLiteContext_TfLiteRegistration_TfLiteIntArray_TfLiteDelegate
Replace ops with one or more stub delegate operations.
|
static class |
TfLiteContext.RequestScratchBufferInArena_TfLiteContext_long_IntPointer
Request a scratch buffer in the arena through static memory planning.
|
static class |
TfLiteContext.ResizeTensor_TfLiteContext_TfLiteTensor_TfLiteIntArray
Request memory pointer be resized.
|
static class |
TfLiteContext.ResizeTensorExplicit_TfLiteContext_TfLiteTensor_int_IntPointer
Resize the memory pointer of the
tensor . |
static class |
TfLiteContext.SetExternalContext_TfLiteContext_int_TfLiteExternalContext
Set the value of a external context.
|
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
TfLiteContext()
Default native constructor.
|
TfLiteContext(long size)
Native array allocator.
|
TfLiteContext(Pointer p)
Pointer cast constructor.
|
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public TfLiteContext()
public TfLiteContext(long size)
Pointer.position(long)
.public TfLiteContext(Pointer p)
Pointer(Pointer)
.public TfLiteContext position(long position)
public TfLiteContext getPointer(long i)
getPointer
in class Pointer
public TfLiteContext tensors_size(long setter)
public TfLiteContext.GetExecutionPlan_TfLiteContext_PointerPointer GetExecutionPlan()
public TfLiteContext GetExecutionPlan(TfLiteContext.GetExecutionPlan_TfLiteContext_PointerPointer setter)
public TfLiteTensor tensors()
tensors_size
)public TfLiteContext tensors(TfLiteTensor setter)
public Pointer impl_()
public TfLiteContext impl_(Pointer setter)
public TfLiteContext.ResizeTensor_TfLiteContext_TfLiteTensor_TfLiteIntArray ResizeTensor()
public TfLiteContext ResizeTensor(TfLiteContext.ResizeTensor_TfLiteContext_TfLiteTensor_TfLiteIntArray setter)
public TfLiteContext.AddTensors_TfLiteContext_int_IntPointer AddTensors()
public TfLiteContext AddTensors(TfLiteContext.AddTensors_TfLiteContext_int_IntPointer setter)
public TfLiteContext.GetNodeAndRegistration_TfLiteContext_int_PointerPointer_PointerPointer GetNodeAndRegistration()
public TfLiteContext GetNodeAndRegistration(TfLiteContext.GetNodeAndRegistration_TfLiteContext_int_PointerPointer_PointerPointer setter)
public TfLiteContext.ReplaceNodeSubsetsWithDelegateKernels_TfLiteContext_TfLiteRegistration_TfLiteIntArray_TfLiteDelegate ReplaceNodeSubsetsWithDelegateKernels()
public TfLiteContext ReplaceNodeSubsetsWithDelegateKernels(TfLiteContext.ReplaceNodeSubsetsWithDelegateKernels_TfLiteContext_TfLiteRegistration_TfLiteIntArray_TfLiteDelegate setter)
public int recommended_num_threads()
public TfLiteContext recommended_num_threads(int setter)
public TfLiteContext.GetExternalContext_TfLiteContext_int GetExternalContext()
public TfLiteContext GetExternalContext(TfLiteContext.GetExternalContext_TfLiteContext_int setter)
public TfLiteContext.SetExternalContext_TfLiteContext_int_TfLiteExternalContext SetExternalContext()
public TfLiteContext SetExternalContext(TfLiteContext.SetExternalContext_TfLiteContext_int_TfLiteExternalContext setter)
@Cast(value="bool") public boolean allow_fp32_relax_to_fp16()
public TfLiteContext allow_fp32_relax_to_fp16(boolean setter)
public Pointer profiler()
public TfLiteContext profiler(Pointer setter)
public TfLiteContext.AllocatePersistentBuffer_TfLiteContext_long AllocatePersistentBuffer()
public TfLiteContext AllocatePersistentBuffer(TfLiteContext.AllocatePersistentBuffer_TfLiteContext_long setter)
public TfLiteContext.AllocateBufferForEval_TfLiteContext_long_PointerPointer AllocateBufferForEval()
public TfLiteContext AllocateBufferForEval(TfLiteContext.AllocateBufferForEval_TfLiteContext_long_PointerPointer setter)
public TfLiteContext.RequestScratchBufferInArena_TfLiteContext_long_IntPointer RequestScratchBufferInArena()
public TfLiteContext RequestScratchBufferInArena(TfLiteContext.RequestScratchBufferInArena_TfLiteContext_long_IntPointer setter)
public TfLiteContext.GetScratchBuffer_TfLiteContext_int GetScratchBuffer()
public TfLiteContext GetScratchBuffer(TfLiteContext.GetScratchBuffer_TfLiteContext_int setter)
public TfLiteContext.ResizeTensorExplicit_TfLiteContext_TfLiteTensor_int_IntPointer ResizeTensorExplicit()
public TfLiteContext ResizeTensorExplicit(TfLiteContext.ResizeTensorExplicit_TfLiteContext_TfLiteTensor_int_IntPointer setter)
public TfLiteContext.PreviewDelegatePartitioning_TfLiteContext_TfLiteIntArray_PointerPointer_IntPointer PreviewDelegatePartitioning()
public TfLiteContext PreviewDelegatePartitioning(TfLiteContext.PreviewDelegatePartitioning_TfLiteContext_TfLiteIntArray_PointerPointer_IntPointer setter)
public TfLiteContext.GetTensor_TfLiteContext_int GetTensor()
public TfLiteContext GetTensor(TfLiteContext.GetTensor_TfLiteContext_int setter)
public TfLiteContext.GetEvalTensor_TfLiteContext_int GetEvalTensor()
public TfLiteContext GetEvalTensor(TfLiteContext.GetEvalTensor_TfLiteContext_int setter)
public TfLiteContext.GetModelMetadata_TfLiteContext_BytePointer_PointerPointer_SizeTPointer GetModelMetadata()
public TfLiteContext GetModelMetadata(TfLiteContext.GetModelMetadata_TfLiteContext_BytePointer_PointerPointer_SizeTPointer setter)
public TfLiteContext.AcquireSubgraphContext_TfLiteContext_int_PointerPointer AcquireSubgraphContext()
public TfLiteContext AcquireSubgraphContext(TfLiteContext.AcquireSubgraphContext_TfLiteContext_int_PointerPointer setter)
public TfLiteContext.ReleaseSubgraphContext_TfLiteContext_int ReleaseSubgraphContext()
public TfLiteContext ReleaseSubgraphContext(TfLiteContext.ReleaseSubgraphContext_TfLiteContext_int setter)
Copyright © 2025. All rights reserved.