Skip to main content

tensorflowlite_c

Struct tensorflowlite_c 

Source
pub struct tensorflowlite_c {
Show 161 fields pub TfLiteOperatorCreate: Result<unsafe extern "C" fn(builtin_code: TfLiteBuiltinOperator, custom_name: *const c_char, version: c_int, user_data: *mut c_void) -> *mut TfLiteOperator, Error>, pub TfLiteOperatorDelete: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator), Error>, pub TfLiteOperatorGetBuiltInCode: Result<unsafe extern "C" fn(registration: *const TfLiteOperator) -> TfLiteBuiltinOperator, Error>, pub TfLiteOperatorGetCustomName: Result<unsafe extern "C" fn(registration: *const TfLiteOperator) -> *const c_char, Error>, pub TfLiteOperatorGetVersion: Result<unsafe extern "C" fn(registration: *const TfLiteOperator) -> c_int, Error>, pub TfLiteOperatorGetUserData: Result<unsafe extern "C" fn(registration: *const TfLiteOperator) -> *mut c_void, Error>, pub TfLiteOperatorSetInit: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, init: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, buffer: *const c_char, length: usize) -> *mut c_void>), Error>, pub TfLiteOperatorSetInitWithData: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, init: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, buffer: *const c_char, length: usize) -> *mut c_void>) -> TfLiteStatus, Error>, pub TfLiteOperatorSetFree: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, free: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, data: *mut c_void)>), Error>, pub TfLiteOperatorSetFreeWithData: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, free: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, data: *mut c_void)>) -> TfLiteStatus, Error>, pub TfLiteOperatorSetPrepare: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, prepare: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> TfLiteStatus>), Error>, pub TfLiteOperatorSetPrepareWithData: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, prepare: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> TfLiteStatus>) -> TfLiteStatus, Error>, pub TfLiteOperatorSetInvoke: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, invoke: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> TfLiteStatus>), Error>, pub TfLiteOperatorSetInvokeWithData: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, invoke: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> TfLiteStatus>) -> TfLiteStatus, Error>, pub TfLiteOperatorSetAsyncKernel: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, async_kernel: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> *mut TfLiteAsyncKernel>), Error>, pub TfLiteOperatorSetAsyncKernelWithData: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, async_kernel: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> *mut TfLiteAsyncKernel>) -> TfLiteStatus, Error>, pub TfLiteOperatorSetInplaceOperator: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, inplace_operator: u64), Error>, pub TfLiteVersion: Result<unsafe extern "C" fn() -> *const c_char, Error>, pub TfLiteExtensionApisVersion: Result<unsafe extern "C" fn() -> *const c_char, Error>, pub TfLiteSchemaVersion: Result<unsafe extern "C" fn() -> c_int, Error>, pub TfLiteModelCreate: Result<unsafe extern "C" fn(model_data: *const c_void, model_size: usize) -> *mut TfLiteModel, Error>, pub TfLiteModelCreateWithErrorReporter: Result<unsafe extern "C" fn(model_data: *const c_void, model_size: usize, reporter: Option<unsafe extern "C" fn(user_data: *mut c_void, format: *const c_char, args: *mut __va_list_tag)>, user_data: *mut c_void) -> *mut TfLiteModel, Error>, pub TfLiteModelCreateFromFile: Result<unsafe extern "C" fn(model_path: *const c_char) -> *mut TfLiteModel, Error>, pub TfLiteModelCreateFromFileWithErrorReporter: Result<unsafe extern "C" fn(model_path: *const c_char, reporter: Option<unsafe extern "C" fn(user_data: *mut c_void, format: *const c_char, args: *mut __va_list_tag)>, user_data: *mut c_void) -> *mut TfLiteModel, Error>, pub TfLiteModelDelete: Result<unsafe extern "C" fn(model: *mut TfLiteModel), Error>, pub TfLiteInterpreterOptionsCreate: Result<unsafe extern "C" fn() -> *mut TfLiteInterpreterOptions, Error>, pub TfLiteInterpreterOptionsCopy: Result<unsafe extern "C" fn(from: *const TfLiteInterpreterOptions) -> *mut TfLiteInterpreterOptions, Error>, pub TfLiteInterpreterOptionsDelete: Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions), Error>, pub TfLiteInterpreterOptionsSetNumThreads: Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions, num_threads: i32), Error>, pub TfLiteInterpreterOptionsAddDelegate: Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions, delegate: *mut TfLiteOpaqueDelegate), Error>, pub TfLiteInterpreterOptionsSetErrorReporter: Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions, reporter: Option<unsafe extern "C" fn(user_data: *mut c_void, format: *const c_char, args: *mut __va_list_tag)>, user_data: *mut c_void), Error>, pub TfLiteInterpreterOptionsAddOperator: Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions, registration: *mut TfLiteOperator), Error>, pub TfLiteInterpreterOptionsEnableCancellation: Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions, enable: bool) -> TfLiteStatus, Error>, pub TfLiteInterpreterCreate: Result<unsafe extern "C" fn(model: *const TfLiteModel, optional_options: *const TfLiteInterpreterOptions) -> *mut TfLiteInterpreter, Error>, pub TfLiteInterpreterDelete: Result<unsafe extern "C" fn(interpreter: *mut TfLiteInterpreter), Error>, pub TfLiteInterpreterGetInputTensorCount: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> i32, Error>, pub TfLiteInterpreterInputTensorIndices: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> *const c_int, Error>, pub TfLiteInterpreterGetInputTensor: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter, input_index: i32) -> *mut TfLiteTensor, Error>, pub TfLiteInterpreterResizeInputTensor: Result<unsafe extern "C" fn(interpreter: *mut TfLiteInterpreter, input_index: i32, input_dims: *const c_int, input_dims_size: i32) -> TfLiteStatus, Error>, pub TfLiteInterpreterAllocateTensors: Result<unsafe extern "C" fn(interpreter: *mut TfLiteInterpreter) -> TfLiteStatus, Error>, pub TfLiteInterpreterInvoke: Result<unsafe extern "C" fn(interpreter: *mut TfLiteInterpreter) -> TfLiteStatus, Error>, pub TfLiteInterpreterGetOutputTensorCount: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> i32, Error>, pub TfLiteInterpreterOutputTensorIndices: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> *const c_int, Error>, pub TfLiteInterpreterGetOutputTensor: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter, output_index: i32) -> *const TfLiteTensor, Error>, pub TfLiteInterpreterGetTensor: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter, index: c_int) -> *mut TfLiteTensor, Error>, pub TfLiteInterpreterCancel: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> TfLiteStatus, Error>, pub TfLiteInterpreterGetSignatureCount: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> i32, Error>, pub TfLiteInterpreterGetSignatureKey: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter, signature_index: i32) -> *const c_char, Error>, pub TfLiteInterpreterGetSignatureRunner: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter, signature_key: *const c_char) -> *mut TfLiteSignatureRunner, Error>, pub TfLiteSignatureRunnerGetInputCount: Result<unsafe extern "C" fn(signature_runner: *const TfLiteSignatureRunner) -> usize, Error>, pub TfLiteSignatureRunnerGetInputName: Result<unsafe extern "C" fn(signature_runner: *const TfLiteSignatureRunner, input_index: i32) -> *const c_char, Error>, pub TfLiteSignatureRunnerResizeInputTensor: Result<unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner, input_name: *const c_char, input_dims: *const c_int, input_dims_size: i32) -> TfLiteStatus, Error>, pub TfLiteSignatureRunnerAllocateTensors: Result<unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner) -> TfLiteStatus, Error>, pub TfLiteSignatureRunnerGetInputTensor: Result<unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner, input_name: *const c_char) -> *mut TfLiteTensor, Error>, pub TfLiteSignatureRunnerInvoke: Result<unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner) -> TfLiteStatus, Error>, pub TfLiteSignatureRunnerGetOutputCount: Result<unsafe extern "C" fn(signature_runner: *const TfLiteSignatureRunner) -> usize, Error>, pub TfLiteSignatureRunnerGetOutputName: Result<unsafe extern "C" fn(signature_runner: *const TfLiteSignatureRunner, output_index: i32) -> *const c_char, Error>, pub TfLiteSignatureRunnerGetOutputTensor: Result<unsafe extern "C" fn(signature_runner: *const TfLiteSignatureRunner, output_name: *const c_char) -> *const TfLiteTensor, Error>, pub TfLiteTensorType: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> TfLiteType, Error>, pub TfLiteTensorNumDims: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> i32, Error>, pub TfLiteTensorDim: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor, dim_index: i32) -> i32, Error>, pub TfLiteTensorByteSize: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> usize, Error>, pub TfLiteTensorData: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> *mut c_void, Error>, pub TfLiteTensorName: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> *const c_char, Error>, pub TfLiteTensorQuantizationParams: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> TfLiteQuantizationParams, Error>, pub TfLiteTensorCopyFromBuffer: Result<unsafe extern "C" fn(tensor: *mut TfLiteTensor, input_data: *const c_void, input_data_size: usize) -> TfLiteStatus, Error>, pub TfLiteTensorCopyToBuffer: Result<unsafe extern "C" fn(output_tensor: *const TfLiteTensor, output_data: *mut c_void, output_data_size: usize) -> TfLiteStatus, Error>, pub TfLiteSignatureRunnerDelete: Result<unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner), Error>, pub TfLiteIntArrayGetSizeInBytes: Result<unsafe extern "C" fn(size: c_int) -> usize, Error>, pub TfLiteIntArrayCreate: Result<unsafe extern "C" fn(size: c_int) -> *mut TfLiteIntArray, Error>, pub TfLiteIntArrayEqual: Result<unsafe extern "C" fn(a: *const TfLiteIntArray, b: *const TfLiteIntArray) -> c_int, Error>, pub TfLiteIntArrayEqualsArray: Result<unsafe extern "C" fn(a: *const TfLiteIntArray, b_size: c_int, b_data: *const c_int) -> c_int, Error>, pub TfLiteIntArrayCopy: Result<unsafe extern "C" fn(src: *const TfLiteIntArray) -> *mut TfLiteIntArray, Error>, pub TfLiteIntArrayFree: Result<unsafe extern "C" fn(a: *mut TfLiteIntArray), Error>, pub TfLiteFloatArrayGetSizeInBytes: Result<unsafe extern "C" fn(size: c_int) -> c_int, Error>, pub TfLiteFloatArrayCreate: Result<unsafe extern "C" fn(size: c_int) -> *mut TfLiteFloatArray, Error>, pub TfLiteFloatArrayCopy: Result<unsafe extern "C" fn(src: *const TfLiteFloatArray) -> *mut TfLiteFloatArray, Error>, pub TfLiteFloatArrayFree: Result<unsafe extern "C" fn(a: *mut TfLiteFloatArray), Error>, pub TfLiteTypeGetName: Result<unsafe extern "C" fn(type_: TfLiteType) -> *const c_char, Error>, pub TfLiteTensorDataFree: Result<unsafe extern "C" fn(t: *mut TfLiteTensor), Error>, pub TfLiteQuantizationFree: Result<unsafe extern "C" fn(quantization: *mut TfLiteQuantization), Error>, pub TfLiteSparsityFree: Result<unsafe extern "C" fn(sparsity: *mut TfLiteSparsity), Error>, pub TfLiteTensorFree: Result<unsafe extern "C" fn(t: *mut TfLiteTensor), Error>, pub TfLiteTensorReset: Result<unsafe extern "C" fn(type_: TfLiteType, name: *const c_char, dims: *mut TfLiteIntArray, quantization: TfLiteQuantizationParams, buffer: *mut c_char, size: usize, allocation_type: TfLiteAllocationType, allocation: *const c_void, is_variable: bool, tensor: *mut TfLiteTensor), Error>, pub TfLiteTensorCopy: Result<unsafe extern "C" fn(src: *const TfLiteTensor, dst: *mut TfLiteTensor) -> TfLiteStatus, Error>, pub TfLiteTensorResizeMaybeCopy: Result<unsafe extern "C" fn(num_bytes: usize, tensor: *mut TfLiteTensor, preserve_data: bool) -> TfLiteStatus, Error>, pub TfLiteTensorRealloc: Result<unsafe extern "C" fn(num_bytes: usize, tensor: *mut TfLiteTensor) -> TfLiteStatus, Error>, pub TfLiteDelegateCreate: Result<unsafe extern "C" fn() -> TfLiteDelegate, Error>, pub TfLiteOpaqueDelegateCreate: Result<unsafe extern "C" fn(opaque_delegate_builder: *const TfLiteOpaqueDelegateBuilder) -> *mut TfLiteOpaqueDelegate, Error>, pub TfLiteOpaqueDelegateDelete: Result<unsafe extern "C" fn(delegate: *mut TfLiteOpaqueDelegate), Error>, pub TfLiteOpaqueDelegateGetData: Result<unsafe extern "C" fn(delegate: *const TfLiteOpaqueDelegate) -> *mut c_void, Error>, pub TfLiteTensorGetAllocationStrategy: Result<unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteAllocationStrategy, Error>, pub TfLiteTensorGetBufferAddressStability: Result<unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteRunStability, Error>, pub TfLiteTensorGetDataStability: Result<unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteRunStability, Error>, pub TfLiteTensorGetDataKnownStep: Result<unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteRunStep, Error>, pub TfLiteTensorGetShapeKnownStep: Result<unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteRunStep, Error>, pub TfLiteOpaqueTensorType: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> TfLiteType, Error>, pub TfLiteOpaqueTensorNumDims: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> i32, Error>, pub TfLiteOpaqueTensorDim: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor, dim_index: i32) -> i32, Error>, pub TfLiteOpaqueTensorGetNumDimsSignature: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor, num_dims: *mut i32) -> TfLiteStatus, Error>, pub TfLiteOpaqueTensorGetDimSignature: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor, dim_index: i32, dim_length: *mut i32) -> TfLiteStatus, Error>, pub TfLiteOpaqueTensorIsVariable: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> c_int, Error>, pub TfLiteOpaqueTensorByteSize: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> usize, Error>, pub TfLiteOpaqueTensorData: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> *mut c_void, Error>, pub TfLiteOpaqueTensorGetAllocationType: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> TfLiteAllocationType, Error>, pub TfLiteOpaqueTensorGetAllocationStrategy: Result<unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteAllocationStrategy, Error>, pub TfLiteOpaqueTensorGetBufferAddressStability: Result<unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteRunStability, Error>, pub TfLiteOpaqueTensorGetDataStability: Result<unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteRunStability, Error>, pub TfLiteOpaqueTensorGetDataKnownStep: Result<unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteRunStep, Error>, pub TfLiteOpaqueTensorGetShapeKnownStep: Result<unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteRunStep, Error>, pub TfLiteOpaqueTensorName: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> *const c_char, Error>, pub TfLiteOpaqueTensorGetQuantization: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> TfLiteQuantization, Error>, pub TfLiteOpaqueTensorGetQuantizationParams: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> TfLiteQuantizationParams, Error>, pub TfLiteOpaqueTensorCopyFromBuffer: Result<unsafe extern "C" fn(opaque_tensor: *mut TfLiteOpaqueTensor, input_data: *const c_void, input_data_size: usize) -> TfLiteStatus, Error>, pub TfLiteOpaqueTensorCopyToBuffer: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor, output_data: *mut c_void, output_data_size: usize) -> TfLiteStatus, Error>, pub TfLiteOpaqueTensorGetStringCount: Result<unsafe extern "C" fn(tensor: *const TfLiteOpaqueTensor) -> c_int, Error>, pub TfLiteOpaqueTensorGetString: Result<unsafe extern "C" fn(tensor: *const TfLiteOpaqueTensor, index: c_int, str_: *mut *const c_char, len: *mut c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueTensorWriteStrings: Result<unsafe extern "C" fn(tensor: *mut TfLiteOpaqueTensor, str_array: *const *const c_char, str_array_len: c_int, str_n_len: *const c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueTensorWriteString: Result<unsafe extern "C" fn(tensor: *mut TfLiteOpaqueTensor, str_: *const c_char, len: c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueTensorBuilderCreate: Result<unsafe extern "C" fn() -> *mut TfLiteOpaqueTensorBuilder, Error>, pub TfLiteOpaqueTensorBuilderDelete: Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder), Error>, pub TfLiteOpaqueTensorBuilderSetType: Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder, type_: TfLiteType) -> *mut TfLiteOpaqueTensorBuilder, Error>, pub TfLiteOpaqueTensorBuilderSetData: Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder, data: *mut c_void) -> *mut TfLiteOpaqueTensorBuilder, Error>, pub TfLiteOpaqueTensorBuilderSetAllocationType: Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder, allocation_type: TfLiteAllocationType) -> *mut TfLiteOpaqueTensorBuilder, Error>, pub TfLiteOpaqueTensorBuilderSetQuantizationParams: Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder, params: TfLiteQuantizationParams) -> *mut TfLiteOpaqueTensorBuilder, Error>, pub TfLiteOpaqueTensorBuilderSetQuantization: Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder, quantization: TfLiteQuantization) -> *mut TfLiteOpaqueTensorBuilder, Error>, pub TfLiteOpaqueTensorSetAllocationTypeToDynamic: Result<unsafe extern "C" fn(tensor: *mut TfLiteOpaqueTensor), Error>, pub TfLiteOpaqueNodeGetInput: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext, opaque_node: *const TfLiteOpaqueNode, index: c_int) -> *const TfLiteOpaqueTensor, Error>, pub TfLiteOpaqueNodeGetOutput: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, opaque_node: *const TfLiteOpaqueNode, index: c_int) -> *mut TfLiteOpaqueTensor, Error>, pub TfLiteOpaqueNodeNumberOfInputs: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode) -> c_int, Error>, pub TfLiteOpaqueNodeNumberOfOutputs: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode) -> c_int, Error>, pub TfLiteOpaqueNodeGetUserData: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode) -> *mut c_void, Error>, pub TfLiteOpaqueNodeGetBuiltinData: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode) -> *mut c_void, Error>, pub TfLiteOpaqueNodeGetCustomInitialData: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode, init_data: *mut *const c_void, size: *mut c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueNodeInputs: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode, inputs: *mut *const c_int, num_inputs: *mut c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueNodeOutputs: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode, outputs: *mut *const c_int, num_outputs: *mut c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueNodeSetTemporaries: Result<unsafe extern "C" fn(opaque_node: *mut TfLiteOpaqueNode, temporaries: *const c_int, num_temporaries: c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueNodeTemporaries: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode, temporaries: *mut *const c_int, num_temporaries: *mut c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueNodeGetInputTensorIndex: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode, index_of_input: c_int) -> c_int, Error>, pub TfLiteOpaqueNodeGetOutputTensorIndex: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode, index_of_output: c_int) -> c_int, Error>, pub TfLiteOpaqueContextGetExecutionPlan: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, execution_plan: *mut *mut TfLiteIntArray) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextGetExternalContext: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, external_context: *mut *mut c_void, type_: TfLiteExternalContextType) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextGetNodeAndRegistration: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, node_index: c_int, node: *mut *mut TfLiteOpaqueNode, registration_external: *mut *mut TfLiteOperator) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextReplaceNodeSubsetsWithDelegateKernels: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, registration_external: *mut TfLiteOperator, nodes_to_replace: *const TfLiteIntArray, opaque_delegate: *mut TfLiteOpaqueDelegate) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextGetOpaqueTensor: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext, index: c_int) -> *mut TfLiteOpaqueTensor, Error>, pub TfLiteOpaqueContextGetInputs: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext, inputs: *mut *const c_int, num_inputs: *mut c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextGetOutputs: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext, outputs: *mut *const c_int, num_outputs: *mut c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextGetVariables: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext, variables: *mut *const c_int, num_variables: *mut c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextGetNumNodes: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext) -> usize, Error>, pub TfLiteOpaqueContextGetNumTensors: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext) -> usize, Error>, pub TfLiteOpaqueContextGetName: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext) -> *const c_char, Error>, pub TfLiteOpaqueContextResizeTensor: Result<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, tensor: *mut TfLiteOpaqueTensor, new_size: *mut TfLiteIntArray) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextAcquireSubgraphContext: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, subgraph_index: c_int, acquired_opaque_context: *mut *mut TfLiteOpaqueContext) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextReleaseSubgraphContext: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, subgraph_index: c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextMarkSubgraphAsDelegationSkippable: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, subgraph_index: c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextGetNodeInitDataMmapInfo: Result<unsafe extern "C" fn(context: *const TfLiteOpaqueContext, node: *const TfLiteOpaqueNode, fd: *mut c_int, custom_initial_data_offset_in_file: *mut i64, custom_initial_data_size: *mut i64) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextAddTensor: Result<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, builder: *mut TfLiteOpaqueTensorBuilder, new_tensor_index: *mut c_int) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextGetSizeOfType: Result<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, type_: TfLiteType, bytes: *mut usize) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextGetMetadata: Result<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, name: *const c_char, ptr: *mut *const c_char, bytes: *mut usize) -> TfLiteStatus, Error>, pub TfLiteOpaqueContextReportError: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, format: *const c_char, ...), Error>, pub TfLiteOpaqueContextReportErrorVa: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, format: *const c_char, vlist: *mut __va_list_tag), Error>, /* private fields */
}

Fields§

§TfLiteOperatorCreate: Result<unsafe extern "C" fn(builtin_code: TfLiteBuiltinOperator, custom_name: *const c_char, version: c_int, user_data: *mut c_void) -> *mut TfLiteOperator, Error>§TfLiteOperatorDelete: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator), Error>§TfLiteOperatorGetBuiltInCode: Result<unsafe extern "C" fn(registration: *const TfLiteOperator) -> TfLiteBuiltinOperator, Error>§TfLiteOperatorGetCustomName: Result<unsafe extern "C" fn(registration: *const TfLiteOperator) -> *const c_char, Error>§TfLiteOperatorGetVersion: Result<unsafe extern "C" fn(registration: *const TfLiteOperator) -> c_int, Error>§TfLiteOperatorGetUserData: Result<unsafe extern "C" fn(registration: *const TfLiteOperator) -> *mut c_void, Error>§TfLiteOperatorSetInit: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, init: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, buffer: *const c_char, length: usize) -> *mut c_void>), Error>§TfLiteOperatorSetInitWithData: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, init: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, buffer: *const c_char, length: usize) -> *mut c_void>) -> TfLiteStatus, Error>§TfLiteOperatorSetFree: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, free: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, data: *mut c_void)>), Error>§TfLiteOperatorSetFreeWithData: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, free: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, data: *mut c_void)>) -> TfLiteStatus, Error>§TfLiteOperatorSetPrepare: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, prepare: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> TfLiteStatus>), Error>§TfLiteOperatorSetPrepareWithData: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, prepare: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> TfLiteStatus>) -> TfLiteStatus, Error>§TfLiteOperatorSetInvoke: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, invoke: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> TfLiteStatus>), Error>§TfLiteOperatorSetInvokeWithData: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, invoke: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> TfLiteStatus>) -> TfLiteStatus, Error>§TfLiteOperatorSetAsyncKernel: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, async_kernel: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> *mut TfLiteAsyncKernel>), Error>§TfLiteOperatorSetAsyncKernelWithData: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, async_kernel: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> *mut TfLiteAsyncKernel>) -> TfLiteStatus, Error>§TfLiteOperatorSetInplaceOperator: Result<unsafe extern "C" fn(registration: *mut TfLiteOperator, inplace_operator: u64), Error>§TfLiteVersion: Result<unsafe extern "C" fn() -> *const c_char, Error>§TfLiteExtensionApisVersion: Result<unsafe extern "C" fn() -> *const c_char, Error>§TfLiteSchemaVersion: Result<unsafe extern "C" fn() -> c_int, Error>§TfLiteModelCreate: Result<unsafe extern "C" fn(model_data: *const c_void, model_size: usize) -> *mut TfLiteModel, Error>§TfLiteModelCreateWithErrorReporter: Result<unsafe extern "C" fn(model_data: *const c_void, model_size: usize, reporter: Option<unsafe extern "C" fn(user_data: *mut c_void, format: *const c_char, args: *mut __va_list_tag)>, user_data: *mut c_void) -> *mut TfLiteModel, Error>§TfLiteModelCreateFromFile: Result<unsafe extern "C" fn(model_path: *const c_char) -> *mut TfLiteModel, Error>§TfLiteModelCreateFromFileWithErrorReporter: Result<unsafe extern "C" fn(model_path: *const c_char, reporter: Option<unsafe extern "C" fn(user_data: *mut c_void, format: *const c_char, args: *mut __va_list_tag)>, user_data: *mut c_void) -> *mut TfLiteModel, Error>§TfLiteModelDelete: Result<unsafe extern "C" fn(model: *mut TfLiteModel), Error>§TfLiteInterpreterOptionsCreate: Result<unsafe extern "C" fn() -> *mut TfLiteInterpreterOptions, Error>§TfLiteInterpreterOptionsCopy: Result<unsafe extern "C" fn(from: *const TfLiteInterpreterOptions) -> *mut TfLiteInterpreterOptions, Error>§TfLiteInterpreterOptionsDelete: Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions), Error>§TfLiteInterpreterOptionsSetNumThreads: Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions, num_threads: i32), Error>§TfLiteInterpreterOptionsAddDelegate: Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions, delegate: *mut TfLiteOpaqueDelegate), Error>§TfLiteInterpreterOptionsSetErrorReporter: Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions, reporter: Option<unsafe extern "C" fn(user_data: *mut c_void, format: *const c_char, args: *mut __va_list_tag)>, user_data: *mut c_void), Error>§TfLiteInterpreterOptionsAddOperator: Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions, registration: *mut TfLiteOperator), Error>§TfLiteInterpreterOptionsEnableCancellation: Result<unsafe extern "C" fn(options: *mut TfLiteInterpreterOptions, enable: bool) -> TfLiteStatus, Error>§TfLiteInterpreterCreate: Result<unsafe extern "C" fn(model: *const TfLiteModel, optional_options: *const TfLiteInterpreterOptions) -> *mut TfLiteInterpreter, Error>§TfLiteInterpreterDelete: Result<unsafe extern "C" fn(interpreter: *mut TfLiteInterpreter), Error>§TfLiteInterpreterGetInputTensorCount: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> i32, Error>§TfLiteInterpreterInputTensorIndices: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> *const c_int, Error>§TfLiteInterpreterGetInputTensor: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter, input_index: i32) -> *mut TfLiteTensor, Error>§TfLiteInterpreterResizeInputTensor: Result<unsafe extern "C" fn(interpreter: *mut TfLiteInterpreter, input_index: i32, input_dims: *const c_int, input_dims_size: i32) -> TfLiteStatus, Error>§TfLiteInterpreterAllocateTensors: Result<unsafe extern "C" fn(interpreter: *mut TfLiteInterpreter) -> TfLiteStatus, Error>§TfLiteInterpreterInvoke: Result<unsafe extern "C" fn(interpreter: *mut TfLiteInterpreter) -> TfLiteStatus, Error>§TfLiteInterpreterGetOutputTensorCount: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> i32, Error>§TfLiteInterpreterOutputTensorIndices: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> *const c_int, Error>§TfLiteInterpreterGetOutputTensor: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter, output_index: i32) -> *const TfLiteTensor, Error>§TfLiteInterpreterGetTensor: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter, index: c_int) -> *mut TfLiteTensor, Error>§TfLiteInterpreterCancel: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> TfLiteStatus, Error>§TfLiteInterpreterGetSignatureCount: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter) -> i32, Error>§TfLiteInterpreterGetSignatureKey: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter, signature_index: i32) -> *const c_char, Error>§TfLiteInterpreterGetSignatureRunner: Result<unsafe extern "C" fn(interpreter: *const TfLiteInterpreter, signature_key: *const c_char) -> *mut TfLiteSignatureRunner, Error>§TfLiteSignatureRunnerGetInputCount: Result<unsafe extern "C" fn(signature_runner: *const TfLiteSignatureRunner) -> usize, Error>§TfLiteSignatureRunnerGetInputName: Result<unsafe extern "C" fn(signature_runner: *const TfLiteSignatureRunner, input_index: i32) -> *const c_char, Error>§TfLiteSignatureRunnerResizeInputTensor: Result<unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner, input_name: *const c_char, input_dims: *const c_int, input_dims_size: i32) -> TfLiteStatus, Error>§TfLiteSignatureRunnerAllocateTensors: Result<unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner) -> TfLiteStatus, Error>§TfLiteSignatureRunnerGetInputTensor: Result<unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner, input_name: *const c_char) -> *mut TfLiteTensor, Error>§TfLiteSignatureRunnerInvoke: Result<unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner) -> TfLiteStatus, Error>§TfLiteSignatureRunnerGetOutputCount: Result<unsafe extern "C" fn(signature_runner: *const TfLiteSignatureRunner) -> usize, Error>§TfLiteSignatureRunnerGetOutputName: Result<unsafe extern "C" fn(signature_runner: *const TfLiteSignatureRunner, output_index: i32) -> *const c_char, Error>§TfLiteSignatureRunnerGetOutputTensor: Result<unsafe extern "C" fn(signature_runner: *const TfLiteSignatureRunner, output_name: *const c_char) -> *const TfLiteTensor, Error>§TfLiteTensorType: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> TfLiteType, Error>§TfLiteTensorNumDims: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> i32, Error>§TfLiteTensorDim: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor, dim_index: i32) -> i32, Error>§TfLiteTensorByteSize: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> usize, Error>§TfLiteTensorData: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> *mut c_void, Error>§TfLiteTensorName: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> *const c_char, Error>§TfLiteTensorQuantizationParams: Result<unsafe extern "C" fn(tensor: *const TfLiteTensor) -> TfLiteQuantizationParams, Error>§TfLiteTensorCopyFromBuffer: Result<unsafe extern "C" fn(tensor: *mut TfLiteTensor, input_data: *const c_void, input_data_size: usize) -> TfLiteStatus, Error>§TfLiteTensorCopyToBuffer: Result<unsafe extern "C" fn(output_tensor: *const TfLiteTensor, output_data: *mut c_void, output_data_size: usize) -> TfLiteStatus, Error>§TfLiteSignatureRunnerDelete: Result<unsafe extern "C" fn(signature_runner: *mut TfLiteSignatureRunner), Error>§TfLiteIntArrayGetSizeInBytes: Result<unsafe extern "C" fn(size: c_int) -> usize, Error>§TfLiteIntArrayCreate: Result<unsafe extern "C" fn(size: c_int) -> *mut TfLiteIntArray, Error>§TfLiteIntArrayEqual: Result<unsafe extern "C" fn(a: *const TfLiteIntArray, b: *const TfLiteIntArray) -> c_int, Error>§TfLiteIntArrayEqualsArray: Result<unsafe extern "C" fn(a: *const TfLiteIntArray, b_size: c_int, b_data: *const c_int) -> c_int, Error>§TfLiteIntArrayCopy: Result<unsafe extern "C" fn(src: *const TfLiteIntArray) -> *mut TfLiteIntArray, Error>§TfLiteIntArrayFree: Result<unsafe extern "C" fn(a: *mut TfLiteIntArray), Error>§TfLiteFloatArrayGetSizeInBytes: Result<unsafe extern "C" fn(size: c_int) -> c_int, Error>§TfLiteFloatArrayCreate: Result<unsafe extern "C" fn(size: c_int) -> *mut TfLiteFloatArray, Error>§TfLiteFloatArrayCopy: Result<unsafe extern "C" fn(src: *const TfLiteFloatArray) -> *mut TfLiteFloatArray, Error>§TfLiteFloatArrayFree: Result<unsafe extern "C" fn(a: *mut TfLiteFloatArray), Error>§TfLiteTypeGetName: Result<unsafe extern "C" fn(type_: TfLiteType) -> *const c_char, Error>§TfLiteTensorDataFree: Result<unsafe extern "C" fn(t: *mut TfLiteTensor), Error>§TfLiteQuantizationFree: Result<unsafe extern "C" fn(quantization: *mut TfLiteQuantization), Error>§TfLiteSparsityFree: Result<unsafe extern "C" fn(sparsity: *mut TfLiteSparsity), Error>§TfLiteTensorFree: Result<unsafe extern "C" fn(t: *mut TfLiteTensor), Error>§TfLiteTensorReset: Result<unsafe extern "C" fn(type_: TfLiteType, name: *const c_char, dims: *mut TfLiteIntArray, quantization: TfLiteQuantizationParams, buffer: *mut c_char, size: usize, allocation_type: TfLiteAllocationType, allocation: *const c_void, is_variable: bool, tensor: *mut TfLiteTensor), Error>§TfLiteTensorCopy: Result<unsafe extern "C" fn(src: *const TfLiteTensor, dst: *mut TfLiteTensor) -> TfLiteStatus, Error>§TfLiteTensorResizeMaybeCopy: Result<unsafe extern "C" fn(num_bytes: usize, tensor: *mut TfLiteTensor, preserve_data: bool) -> TfLiteStatus, Error>§TfLiteTensorRealloc: Result<unsafe extern "C" fn(num_bytes: usize, tensor: *mut TfLiteTensor) -> TfLiteStatus, Error>§TfLiteDelegateCreate: Result<unsafe extern "C" fn() -> TfLiteDelegate, Error>§TfLiteOpaqueDelegateCreate: Result<unsafe extern "C" fn(opaque_delegate_builder: *const TfLiteOpaqueDelegateBuilder) -> *mut TfLiteOpaqueDelegate, Error>§TfLiteOpaqueDelegateDelete: Result<unsafe extern "C" fn(delegate: *mut TfLiteOpaqueDelegate), Error>§TfLiteOpaqueDelegateGetData: Result<unsafe extern "C" fn(delegate: *const TfLiteOpaqueDelegate) -> *mut c_void, Error>§TfLiteTensorGetAllocationStrategy: Result<unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteAllocationStrategy, Error>§TfLiteTensorGetBufferAddressStability: Result<unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteRunStability, Error>§TfLiteTensorGetDataStability: Result<unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteRunStability, Error>§TfLiteTensorGetDataKnownStep: Result<unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteRunStep, Error>§TfLiteTensorGetShapeKnownStep: Result<unsafe extern "C" fn(t: *const TfLiteTensor) -> TfLiteRunStep, Error>§TfLiteOpaqueTensorType: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> TfLiteType, Error>§TfLiteOpaqueTensorNumDims: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> i32, Error>§TfLiteOpaqueTensorDim: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor, dim_index: i32) -> i32, Error>§TfLiteOpaqueTensorGetNumDimsSignature: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor, num_dims: *mut i32) -> TfLiteStatus, Error>§TfLiteOpaqueTensorGetDimSignature: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor, dim_index: i32, dim_length: *mut i32) -> TfLiteStatus, Error>§TfLiteOpaqueTensorIsVariable: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> c_int, Error>§TfLiteOpaqueTensorByteSize: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> usize, Error>§TfLiteOpaqueTensorData: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> *mut c_void, Error>§TfLiteOpaqueTensorGetAllocationType: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> TfLiteAllocationType, Error>§TfLiteOpaqueTensorGetAllocationStrategy: Result<unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteAllocationStrategy, Error>§TfLiteOpaqueTensorGetBufferAddressStability: Result<unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteRunStability, Error>§TfLiteOpaqueTensorGetDataStability: Result<unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteRunStability, Error>§TfLiteOpaqueTensorGetDataKnownStep: Result<unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteRunStep, Error>§TfLiteOpaqueTensorGetShapeKnownStep: Result<unsafe extern "C" fn(t: *const TfLiteOpaqueTensor) -> TfLiteRunStep, Error>§TfLiteOpaqueTensorName: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> *const c_char, Error>§TfLiteOpaqueTensorGetQuantization: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> TfLiteQuantization, Error>§TfLiteOpaqueTensorGetQuantizationParams: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor) -> TfLiteQuantizationParams, Error>§TfLiteOpaqueTensorCopyFromBuffer: Result<unsafe extern "C" fn(opaque_tensor: *mut TfLiteOpaqueTensor, input_data: *const c_void, input_data_size: usize) -> TfLiteStatus, Error>§TfLiteOpaqueTensorCopyToBuffer: Result<unsafe extern "C" fn(opaque_tensor: *const TfLiteOpaqueTensor, output_data: *mut c_void, output_data_size: usize) -> TfLiteStatus, Error>§TfLiteOpaqueTensorGetStringCount: Result<unsafe extern "C" fn(tensor: *const TfLiteOpaqueTensor) -> c_int, Error>§TfLiteOpaqueTensorGetString: Result<unsafe extern "C" fn(tensor: *const TfLiteOpaqueTensor, index: c_int, str_: *mut *const c_char, len: *mut c_int) -> TfLiteStatus, Error>§TfLiteOpaqueTensorWriteStrings: Result<unsafe extern "C" fn(tensor: *mut TfLiteOpaqueTensor, str_array: *const *const c_char, str_array_len: c_int, str_n_len: *const c_int) -> TfLiteStatus, Error>§TfLiteOpaqueTensorWriteString: Result<unsafe extern "C" fn(tensor: *mut TfLiteOpaqueTensor, str_: *const c_char, len: c_int) -> TfLiteStatus, Error>§TfLiteOpaqueTensorBuilderCreate: Result<unsafe extern "C" fn() -> *mut TfLiteOpaqueTensorBuilder, Error>§TfLiteOpaqueTensorBuilderDelete: Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder), Error>§TfLiteOpaqueTensorBuilderSetType: Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder, type_: TfLiteType) -> *mut TfLiteOpaqueTensorBuilder, Error>§TfLiteOpaqueTensorBuilderSetData: Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder, data: *mut c_void) -> *mut TfLiteOpaqueTensorBuilder, Error>§TfLiteOpaqueTensorBuilderSetAllocationType: Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder, allocation_type: TfLiteAllocationType) -> *mut TfLiteOpaqueTensorBuilder, Error>§TfLiteOpaqueTensorBuilderSetQuantizationParams: Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder, params: TfLiteQuantizationParams) -> *mut TfLiteOpaqueTensorBuilder, Error>§TfLiteOpaqueTensorBuilderSetQuantization: Result<unsafe extern "C" fn(builder: *mut TfLiteOpaqueTensorBuilder, quantization: TfLiteQuantization) -> *mut TfLiteOpaqueTensorBuilder, Error>§TfLiteOpaqueTensorSetAllocationTypeToDynamic: Result<unsafe extern "C" fn(tensor: *mut TfLiteOpaqueTensor), Error>§TfLiteOpaqueNodeGetInput: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext, opaque_node: *const TfLiteOpaqueNode, index: c_int) -> *const TfLiteOpaqueTensor, Error>§TfLiteOpaqueNodeGetOutput: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, opaque_node: *const TfLiteOpaqueNode, index: c_int) -> *mut TfLiteOpaqueTensor, Error>§TfLiteOpaqueNodeNumberOfInputs: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode) -> c_int, Error>§TfLiteOpaqueNodeNumberOfOutputs: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode) -> c_int, Error>§TfLiteOpaqueNodeGetUserData: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode) -> *mut c_void, Error>§TfLiteOpaqueNodeGetBuiltinData: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode) -> *mut c_void, Error>§TfLiteOpaqueNodeGetCustomInitialData: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode, init_data: *mut *const c_void, size: *mut c_int) -> TfLiteStatus, Error>§TfLiteOpaqueNodeInputs: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode, inputs: *mut *const c_int, num_inputs: *mut c_int) -> TfLiteStatus, Error>§TfLiteOpaqueNodeOutputs: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode, outputs: *mut *const c_int, num_outputs: *mut c_int) -> TfLiteStatus, Error>§TfLiteOpaqueNodeSetTemporaries: Result<unsafe extern "C" fn(opaque_node: *mut TfLiteOpaqueNode, temporaries: *const c_int, num_temporaries: c_int) -> TfLiteStatus, Error>§TfLiteOpaqueNodeTemporaries: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode, temporaries: *mut *const c_int, num_temporaries: *mut c_int) -> TfLiteStatus, Error>§TfLiteOpaqueNodeGetInputTensorIndex: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode, index_of_input: c_int) -> c_int, Error>§TfLiteOpaqueNodeGetOutputTensorIndex: Result<unsafe extern "C" fn(opaque_node: *const TfLiteOpaqueNode, index_of_output: c_int) -> c_int, Error>§TfLiteOpaqueContextGetExecutionPlan: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, execution_plan: *mut *mut TfLiteIntArray) -> TfLiteStatus, Error>§TfLiteOpaqueContextGetExternalContext: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, external_context: *mut *mut c_void, type_: TfLiteExternalContextType) -> TfLiteStatus, Error>§TfLiteOpaqueContextGetNodeAndRegistration: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, node_index: c_int, node: *mut *mut TfLiteOpaqueNode, registration_external: *mut *mut TfLiteOperator) -> TfLiteStatus, Error>§TfLiteOpaqueContextReplaceNodeSubsetsWithDelegateKernels: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, registration_external: *mut TfLiteOperator, nodes_to_replace: *const TfLiteIntArray, opaque_delegate: *mut TfLiteOpaqueDelegate) -> TfLiteStatus, Error>§TfLiteOpaqueContextGetOpaqueTensor: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext, index: c_int) -> *mut TfLiteOpaqueTensor, Error>§TfLiteOpaqueContextGetInputs: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext, inputs: *mut *const c_int, num_inputs: *mut c_int) -> TfLiteStatus, Error>§TfLiteOpaqueContextGetOutputs: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext, outputs: *mut *const c_int, num_outputs: *mut c_int) -> TfLiteStatus, Error>§TfLiteOpaqueContextGetVariables: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext, variables: *mut *const c_int, num_variables: *mut c_int) -> TfLiteStatus, Error>§TfLiteOpaqueContextGetNumNodes: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext) -> usize, Error>§TfLiteOpaqueContextGetNumTensors: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext) -> usize, Error>§TfLiteOpaqueContextGetName: Result<unsafe extern "C" fn(opaque_context: *const TfLiteOpaqueContext) -> *const c_char, Error>§TfLiteOpaqueContextResizeTensor: Result<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, tensor: *mut TfLiteOpaqueTensor, new_size: *mut TfLiteIntArray) -> TfLiteStatus, Error>§TfLiteOpaqueContextAcquireSubgraphContext: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, subgraph_index: c_int, acquired_opaque_context: *mut *mut TfLiteOpaqueContext) -> TfLiteStatus, Error>§TfLiteOpaqueContextReleaseSubgraphContext: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, subgraph_index: c_int) -> TfLiteStatus, Error>§TfLiteOpaqueContextMarkSubgraphAsDelegationSkippable: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, subgraph_index: c_int) -> TfLiteStatus, Error>§TfLiteOpaqueContextGetNodeInitDataMmapInfo: Result<unsafe extern "C" fn(context: *const TfLiteOpaqueContext, node: *const TfLiteOpaqueNode, fd: *mut c_int, custom_initial_data_offset_in_file: *mut i64, custom_initial_data_size: *mut i64) -> TfLiteStatus, Error>§TfLiteOpaqueContextAddTensor: Result<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, builder: *mut TfLiteOpaqueTensorBuilder, new_tensor_index: *mut c_int) -> TfLiteStatus, Error>§TfLiteOpaqueContextGetSizeOfType: Result<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, type_: TfLiteType, bytes: *mut usize) -> TfLiteStatus, Error>§TfLiteOpaqueContextGetMetadata: Result<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, name: *const c_char, ptr: *mut *const c_char, bytes: *mut usize) -> TfLiteStatus, Error>§TfLiteOpaqueContextReportError: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, format: *const c_char, ...), Error>§TfLiteOpaqueContextReportErrorVa: Result<unsafe extern "C" fn(opaque_context: *mut TfLiteOpaqueContext, format: *const c_char, vlist: *mut __va_list_tag), Error>

Implementations§

Source§

impl tensorflowlite_c

Source

pub unsafe fn new<P>(path: P) -> Result<Self, Error>
where P: AsRef<OsStr>,

Source

pub unsafe fn from_library<L>(library: L) -> Result<Self, Error>
where L: Into<Library>,

Source

pub unsafe fn TfLiteOperatorCreate( &self, builtin_code: TfLiteBuiltinOperator, custom_name: *const c_char, version: c_int, user_data: *mut c_void, ) -> *mut TfLiteOperator

Returns a new TfLiteOperator instance.

The returned TfLiteOperator instance represents a definition of an operator with the identity (builtin_code/custom_name and version) specified by the parameters, but with all callbacks initially unset.

Evaluation of any operation using this operator will be done using the “prepare” and “invoke” callbacks, which can be set using TfLiteOperatorSetPrepare and TfLiteOperatorSetInvoke, or for async execution the “prepare”, “eval”, and “wait” callbacks of the TfLiteAsyncKernel, which can be set using TfLiteOperatorSetAsyncKernel. If the relevant callbacks are not set, then such evaluation will result in an error status. So normally any use of this function should be followed by appropriate calls to set those callbacks.

\note The caller retains ownership and should ensure that the lifetime of the TfLiteOperator must be at least as long as the lifetime of any TfLiteInterpreter or tflite::Interpreter that it is used in.

\param builtin_code Enumeration code specifying which builtin operator this defines, or TfLiteBuiltinCustom to define a custom op. \param custom_name Name of the custom op, or nullptr for a builtin op. If custom_name is non-null, then builtin_code should be TfLiteBuiltinCustom. \param version Version of the op. See https://www.tensorflow.org/lite/guide/ops_version \param user_data Opaque pointer passed to the operator’s callbacks set with functions such as TfLiteOperatorSetXXXWithData. The user is expected to manage the memory pointed by this field and the lifetime of that memory should extend at least from the call to TfLiteOperatorCreate to the invocation of the callback set with TfLiteOperatorSetFreeWithData.

\return a newly created TfLiteOperator on success, or a nullptr on failure

Source

pub unsafe fn TfLiteOperatorDelete(&self, registration: *mut TfLiteOperator)

Destroys the TfLiteOperator instance.

Source

pub unsafe fn TfLiteOperatorGetBuiltInCode( &self, registration: *const TfLiteOperator, ) -> TfLiteBuiltinOperator

Return the builtin op code of the provided external ‘registration’.

Source

pub unsafe fn TfLiteOperatorGetCustomName( &self, registration: *const TfLiteOperator, ) -> *const c_char

Returns the custom name of the provided ‘registration’. The returned pointer will be non-null iff the op is a custom op.

Source

pub unsafe fn TfLiteOperatorGetVersion( &self, registration: *const TfLiteOperator, ) -> c_int

Return the OP version of the provided external ‘registration’. Return -1 in case of error, or if the provided address is null.

Source

pub unsafe fn TfLiteOperatorGetUserData( &self, registration: *const TfLiteOperator, ) -> *mut c_void

Return the user data field of the provided external ‘registration’, or nullptr if none was set.

Source

pub unsafe fn TfLiteOperatorSetInit( &self, registration: *mut TfLiteOperator, init: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, buffer: *const c_char, length: usize) -> *mut c_void>, )

Sets the initialization callback for the registration.

The callback is called to initialize the op from serialized data. Please refer init of TfLiteRegistration for the detail.

Deprecated: Use TfLiteOperatorSetInitWithData

Source

pub unsafe fn TfLiteOperatorSetInitWithData( &self, registration: *mut TfLiteOperator, init: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, buffer: *const c_char, length: usize) -> *mut c_void>, ) -> TfLiteStatus

Sets the initialization callback for the registration. The function returns an error upon failure.

The callback is called to initialize the op from serialized data. The value passed in the user_data parameter is the value that was passed to TfLiteOperatorCreate. Please refer init of TfLiteRegistration for the detail.

Source

pub unsafe fn TfLiteOperatorSetFree( &self, registration: *mut TfLiteOperator, free: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, data: *mut c_void)>, )

Sets the deallocation callback for the registration.

This callback is called to deallocate the data returned by the init callback. The value passed in the data parameter is the value that was returned by the init callback. Please refer free of TfLiteRegistration for the detail.

Deprecated: Use TfLiteOperatorSetFreeWithData

Source

pub unsafe fn TfLiteOperatorSetFreeWithData( &self, registration: *mut TfLiteOperator, free: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, data: *mut c_void)>, ) -> TfLiteStatus

Sets the deallocation callback for the registration, similarly to TfLiteOperatorSetFree. The function returns an error upon failure.

This callback is called to deallocate the data returned by the init callback. The value passed in the data parameter is the value that was returned by the init callback. The value passed in the user_data parameter is the value that was passed to TfLiteOperatorCreate. Please refer free of TfLiteRegistration for the detail.

Source

pub unsafe fn TfLiteOperatorSetPrepare( &self, registration: *mut TfLiteOperator, prepare: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> TfLiteStatus>, )

Sets the preparation callback for the registration.

The callback is called when the inputs of operator have been resized. Please refer prepare of TfLiteRegistration for the detail.

Deprecated: Use TfLiteOperatorSetPrepareWithData

Source

pub unsafe fn TfLiteOperatorSetPrepareWithData( &self, registration: *mut TfLiteOperator, prepare: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> TfLiteStatus>, ) -> TfLiteStatus

Sets the preparation callback for the registration. The function returns an error upon failure.

The callback is called when the inputs of operator have been resized. The value passed in the user_data parameter is the value that was passed to TfLiteOperatorCreate. Please refer prepare of TfLiteRegistration for the detail.

Source

pub unsafe fn TfLiteOperatorSetInvoke( &self, registration: *mut TfLiteOperator, invoke: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> TfLiteStatus>, )

Sets the invocation callback for the registration.

The callback is called when the operator is executed. Please refer invoke of TfLiteRegistration for the detail.

Deprecated: Use TfLiteOperatorSetInvokeWithData

Source

pub unsafe fn TfLiteOperatorSetInvokeWithData( &self, registration: *mut TfLiteOperator, invoke: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> TfLiteStatus>, ) -> TfLiteStatus

Sets the invocation callback for the registration. The function returns an error upon failure.

The callback is called when the operator is executed. The value passed in the user_data parameter is the value that was passed to TfLiteOperatorCreate. Please refer invoke of TfLiteRegistration for the detail.

Source

pub unsafe fn TfLiteOperatorSetAsyncKernel( &self, registration: *mut TfLiteOperator, async_kernel: Option<unsafe extern "C" fn(context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> *mut TfLiteAsyncKernel>, )

Sets the async kernel accessor callback for the registration.

The callback is called to retrieve the async kernel if the delegate supports it. If the delegate does not support async execution, either this function should not be called, or async_kernel needs to be nullptr. node is the delegate TfLiteNode created by ModifyGraphWithDelegate. Please refer async_kernel of TfLiteRegistration for the detail.

\warning This is an experimental API and subject to change. Deprecated: Use TfLiteOperatorSetAsyncKernelWithData

Source

pub unsafe fn TfLiteOperatorSetAsyncKernelWithData( &self, registration: *mut TfLiteOperator, async_kernel: Option<unsafe extern "C" fn(user_data: *mut c_void, context: *mut TfLiteOpaqueContext, node: *mut TfLiteOpaqueNode) -> *mut TfLiteAsyncKernel>, ) -> TfLiteStatus

Sets the async kernel accessor callback for the registration. The function returns an error upon failure.

The callback is called to retrieve the async kernel if the delegate supports it. If the delegate does not support async execution, either this function should not be called, or async_kernel needs to be nullptr. node is the delegate TfLiteNode created by ModifyGraphWithDelegate. The value passed in the user_data parameter is the value that was passed to TfLiteOperatorCreate. Please refer async_kernel of TfLiteRegistration for the detail.

\warning This is an experimental API and subject to change.

Source

pub unsafe fn TfLiteOperatorSetInplaceOperator( &self, registration: *mut TfLiteOperator, inplace_operator: u64, )

Sets the inplace_operator field of the external registration.

This is a bitmask. Please refer to inplace_operator field of TfLiteRegistration for details.

Source

pub unsafe fn TfLiteVersion(&self) -> *const c_char

The TensorFlow Lite Runtime version.

Returns a pointer to a statically allocated string that is the version number of the (potentially dynamically loaded) TF Lite Runtime library. TensorFlow Lite uses semantic versioning, and the return value should be in semver 2 format http://semver.org, starting with MAJOR.MINOR.PATCH, e.g. “2.12.0” or “2.13.0-rc2”.

Source

pub unsafe fn TfLiteExtensionApisVersion(&self) -> *const c_char

The TensorFlow Lite Extension APIs version.

Returns a pointer to a statically allocated string that is the version number of the TF Lite Extension APIs supported by the (potentially dynamically loaded) TF Lite Runtime library. The TF Lite “Extension APIs” are the APIs for extending TF Lite with custom ops and delegates. More specifically, this version number covers the (non-experimental) functionality documented in the following header files:

  • lite/c/c_api_opaque.h
  • lite/c/common.h
  • lite/c/builtin_op_data.h
  • lite/builtin_ops.h

This version number uses semantic versioning, and the return value should be in semver 2 format http://semver.org, starting with MAJOR.MINOR.PATCH, e.g. “2.14.0” or “2.15.0-rc2”.

Source

pub unsafe fn TfLiteSchemaVersion(&self) -> c_int

The supported TensorFlow Lite model file Schema version.

Returns the (major) version number of the Schema used for model files that is supported by the (potentially dynamically loaded) TensorFlow Lite Runtime.

Model files using schema versions different to this may not be supported by the current version of the TF Lite Runtime.

Source

pub unsafe fn TfLiteModelCreate( &self, model_data: *const c_void, model_size: usize, ) -> *mut TfLiteModel

Returns a model from the provided buffer, or null on failure.

\note The caller retains ownership of the model_data buffer and should ensure that the lifetime of the model_data buffer must be at least as long as the lifetime of the TfLiteModel and of any TfLiteInterpreter objects created from that TfLiteModel, and furthermore the contents of the model_data buffer must not be modified during that time.“

Source

pub unsafe fn TfLiteModelCreateWithErrorReporter( &self, model_data: *const c_void, model_size: usize, reporter: Option<unsafe extern "C" fn(user_data: *mut c_void, format: *const c_char, args: *mut __va_list_tag)>, user_data: *mut c_void, ) -> *mut TfLiteModel

Same as TfLiteModelCreate with customizble error reporter.

  • reporter takes the provided user_data object, as well as a C-style format string and arg list (see also vprintf).
  • user_data is optional. If non-null, it is owned by the client and must remain valid for the duration of the interpreter lifetime.
Source

pub unsafe fn TfLiteModelCreateFromFile( &self, model_path: *const c_char, ) -> *mut TfLiteModel

Returns a model from the provided file, or null on failure.

\note The file’s contents must not be modified during the lifetime of the TfLiteModel or of any TfLiteInterpreter objects created from that TfLiteModel.

Source

pub unsafe fn TfLiteModelCreateFromFileWithErrorReporter( &self, model_path: *const c_char, reporter: Option<unsafe extern "C" fn(user_data: *mut c_void, format: *const c_char, args: *mut __va_list_tag)>, user_data: *mut c_void, ) -> *mut TfLiteModel

Same as TfLiteModelCreateFromFile with customizble error reporter.

  • reporter takes the provided user_data object, as well as a C-style format string and arg list (see also vprintf).
  • user_data is optional. If non-null, it is owned by the client and must remain valid for the duration of the interpreter lifetime.
Source

pub unsafe fn TfLiteModelDelete(&self, model: *mut TfLiteModel)

Destroys the model instance.

Source

pub unsafe fn TfLiteInterpreterOptionsCreate( &self, ) -> *mut TfLiteInterpreterOptions

Returns a new interpreter options instances.

Source

pub unsafe fn TfLiteInterpreterOptionsCopy( &self, from: *const TfLiteInterpreterOptions, ) -> *mut TfLiteInterpreterOptions

Creates and returns a shallow copy of an options object.

The caller is responsible for calling TfLiteInterpreterOptionsDelete to deallocate the object pointed to by the returned pointer.

Source

pub unsafe fn TfLiteInterpreterOptionsDelete( &self, options: *mut TfLiteInterpreterOptions, )

Destroys the interpreter options instance.

Source

pub unsafe fn TfLiteInterpreterOptionsSetNumThreads( &self, options: *mut TfLiteInterpreterOptions, num_threads: i32, )

Sets the number of CPU threads to use for the interpreter.

Source

pub unsafe fn TfLiteInterpreterOptionsAddDelegate( &self, options: *mut TfLiteInterpreterOptions, delegate: *mut TfLiteOpaqueDelegate, )

Adds a delegate to be applied during TfLiteInterpreter creation.

If delegate application fails, interpreter creation will also fail with an associated error logged.

\note The caller retains ownership of the delegate and should ensure that it remains valid for the duration of any created interpreter’s lifetime.

If you are NOT using “TensorFlow Lite in Play Services”, and NOT building with TFLITE_WITH_STABLE_ABI or TFLITE_USE_OPAQUE_DELEGATE macros enabled, it is possible to pass a TfLiteDelegate* rather than a TfLiteOpaqueDelegate* to this function, since in those cases, TfLiteOpaqueDelegate is just a typedef alias for TfLiteDelegate. This is for compatibility with existing source code and existing delegates. For new delegates, it is recommended to use TfLiteOpaqueDelegate rather than TfLiteDelegate. (See TfLiteOpaqueDelegate in tensorflow/lite/core/c/c_api_types.h.)

Source

pub unsafe fn TfLiteInterpreterOptionsSetErrorReporter( &self, options: *mut TfLiteInterpreterOptions, reporter: Option<unsafe extern "C" fn(user_data: *mut c_void, format: *const c_char, args: *mut __va_list_tag)>, user_data: *mut c_void, )

Sets a custom error reporter for interpreter execution.

  • reporter takes the provided user_data object, as well as a C-style format string and arg list (see also vprintf).
  • user_data is optional. If non-null, it is owned by the client and must remain valid for the duration of the interpreter lifetime.
Source

pub unsafe fn TfLiteInterpreterOptionsAddOperator( &self, options: *mut TfLiteInterpreterOptions, registration: *mut TfLiteOperator, )

Adds an op registration to be applied during TfLiteInterpreter creation.

The TfLiteOperator object is needed to implement custom op of TFLite Interpreter via C API. Calling this function ensures that any TfLiteInterpreter created with the specified options can execute models that use the custom operator specified in registration. Please refer https://www.tensorflow.org/lite/guide/ops_custom for custom op support. \note The caller retains ownership of the TfLiteOperator object and should ensure that it remains valid for the duration of any created interpreter’s lifetime. \warning This is an experimental API and subject to change.

Source

pub unsafe fn TfLiteInterpreterOptionsEnableCancellation( &self, options: *mut TfLiteInterpreterOptions, enable: bool, ) -> TfLiteStatus

Enables users to cancel in-flight invocations with TfLiteInterpreterCancel.

By default it is disabled and calling to TfLiteInterpreterCancel will return kTfLiteError. See TfLiteInterpreterCancel.

Source

pub unsafe fn TfLiteInterpreterCreate( &self, model: *const TfLiteModel, optional_options: *const TfLiteInterpreterOptions, ) -> *mut TfLiteInterpreter

Returns a new interpreter using the provided model and options, or null on failure.

  • model must be a valid model instance. The caller retains ownership of the object, and may destroy it (via TfLiteModelDelete) immediately after creating the interpreter. However, if the TfLiteModel was allocated with TfLiteModelCreate, then the model_data buffer that was passed to TfLiteModelCreate must outlive the lifetime of the TfLiteInterpreter object that this function returns, and must not be modified during that time; and if the TfLiteModel was allocated with TfLiteModelCreateFromFile, then the contents of the model file must not be modified during the lifetime of the TfLiteInterpreter object that this function returns.
  • optional_options may be null. The caller retains ownership of the object, and can safely destroy it (via TfLiteInterpreterOptionsDelete) immediately after creating the interpreter.

\note The client must explicitly allocate tensors before attempting to access input tensor data or invoke the interpreter.

Source

pub unsafe fn TfLiteInterpreterDelete( &self, interpreter: *mut TfLiteInterpreter, )

Destroys the interpreter.

Source

pub unsafe fn TfLiteInterpreterGetInputTensorCount( &self, interpreter: *const TfLiteInterpreter, ) -> i32

Returns the number of input tensors associated with the model.

Source

pub unsafe fn TfLiteInterpreterInputTensorIndices( &self, interpreter: *const TfLiteInterpreter, ) -> *const c_int

Returns a pointer to an array of input tensor indices. The length of the array can be obtained via a call to TfLiteInterpreterGetInputTensorCount.

Typically the input tensors associated with an interpreter would be set during the initialization of the interpreter, through a mechanism like the InterpreterBuilder, and remain unchanged throughout the lifetime of the interpreter. However, there are some circumstances in which the pointer may not remain valid throughout the lifetime of the interpreter, because calls to SetInputs on the interpreter invalidate the returned pointer.

The ownership of the array remains with the TFLite runtime.

Source

pub unsafe fn TfLiteInterpreterGetInputTensor( &self, interpreter: *const TfLiteInterpreter, input_index: i32, ) -> *mut TfLiteTensor

Returns the tensor associated with the input index. REQUIRES: 0 <= input_index < TfLiteInterpreterGetInputTensorCount(tensor)

Source

pub unsafe fn TfLiteInterpreterResizeInputTensor( &self, interpreter: *mut TfLiteInterpreter, input_index: i32, input_dims: *const c_int, input_dims_size: i32, ) -> TfLiteStatus

Resizes the specified input tensor.

\note After a resize, the client must explicitly allocate tensors before attempting to access the resized tensor data or invoke the interpreter.

REQUIRES: 0 <= input_index < TfLiteInterpreterGetInputTensorCount(tensor)

This function makes a copy of the input dimensions, so the client can safely deallocate input_dims immediately after this function returns.

Source

pub unsafe fn TfLiteInterpreterAllocateTensors( &self, interpreter: *mut TfLiteInterpreter, ) -> TfLiteStatus

Updates allocations for all tensors, resizing dependent tensors using the specified input tensor dimensionality.

This is a relatively expensive operation, and need only be called after creating the graph and/or resizing any inputs.

Source

pub unsafe fn TfLiteInterpreterInvoke( &self, interpreter: *mut TfLiteInterpreter, ) -> TfLiteStatus

Runs inference for the loaded graph.

Before calling this function, the caller should first invoke TfLiteInterpreterAllocateTensors() and should also set the values for the input tensors. After successfully calling this function, the values for the output tensors will be set.

\note It is possible that the interpreter is not in a ready state to evaluate (e.g., if AllocateTensors() hasn’t been called, or if a ResizeInputTensor() has been performed without a subsequent call to AllocateTensors()).

If the (experimental!) delegate fallback option was enabled in the interpreter options, then the interpreter will automatically fall back to not using any delegates if execution with delegates fails. For details, see TfLiteInterpreterOptionsSetEnableDelegateFallback in c_api_experimental.h.

Returns one of the following status codes:

  • kTfLiteOk: Success. Output is valid.
  • kTfLiteDelegateError: Execution with delegates failed, due to a problem with the delegate(s). If fallback was not enabled, output is invalid. If fallback was enabled, this return value indicates that fallback succeeded, the output is valid, and all delegates previously applied to the interpreter have been undone.
  • kTfLiteApplicationError: Same as for kTfLiteDelegateError, except that the problem was not with the delegate itself, but rather was due to an incompatibility between the delegate(s) and the interpreter or model.
  • kTfLiteError: Unexpected/runtime failure. Output is invalid.
Source

pub unsafe fn TfLiteInterpreterGetOutputTensorCount( &self, interpreter: *const TfLiteInterpreter, ) -> i32

Returns the number of output tensors associated with the model.

Source

pub unsafe fn TfLiteInterpreterOutputTensorIndices( &self, interpreter: *const TfLiteInterpreter, ) -> *const c_int

Returns a pointer to an array of output tensor indices. The length of the array can be obtained via a call to TfLiteInterpreterGetOutputTensorCount.

Typically the output tensors associated with an interpreter would be set during the initialization of the interpreter, through a mechanism like the InterpreterBuilder, and remain unchanged throughout the lifetime of the interpreter. However, there are some circumstances in which the pointer may not remain valid throughout the lifetime of the interpreter, because calls to SetOutputs on the interpreter invalidate the returned pointer.

The ownership of the array remains with the TFLite runtime.

Source

pub unsafe fn TfLiteInterpreterGetOutputTensor( &self, interpreter: *const TfLiteInterpreter, output_index: i32, ) -> *const TfLiteTensor

Returns the tensor associated with the output index. REQUIRES: 0 <= output_index < TfLiteInterpreterGetOutputTensorCount(tensor)

\note The shape and underlying data buffer for output tensors may be not be available until after the output tensor has been both sized and allocated. In general, best practice is to interact with the output tensor after calling TfLiteInterpreterInvoke().

Source

pub unsafe fn TfLiteInterpreterGetTensor( &self, interpreter: *const TfLiteInterpreter, index: c_int, ) -> *mut TfLiteTensor

Returns modifiable access to the tensor that corresponds to the specified index and is associated with the provided interpreter.

This requires the index to be between 0 and N - 1, where N is the number of tensors in the model.

Typically the tensors associated with the interpreter would be set during the interpreter initialization, through a mechanism like the InterpreterBuilder, and remain unchanged throughout the lifetime of the interpreter. However, there are some circumstances in which the pointer may not remain valid throughout the lifetime of the interpreter, because calls to AddTensors on the interpreter invalidate the returned pointer.

Note the difference between this function and TfLiteInterpreterGetInputTensor (or TfLiteInterpreterGetOutputTensor for that matter): TfLiteInterpreterGetTensor takes an index into the array of all tensors associated with the interpreter’s model, whereas TfLiteInterpreterGetInputTensor takes an index into the array of input tensors.

The ownership of the tensor remains with the TFLite runtime, meaning the caller should not deallocate the pointer.

Source

pub unsafe fn TfLiteInterpreterCancel( &self, interpreter: *const TfLiteInterpreter, ) -> TfLiteStatus

Tries to cancel any in-flight invocation.

\note This only cancels TfLiteInterpreterInvoke calls that happen before calling this and it does not cancel subsequent invocations. \note Calling this function will also cancel any in-flight invocations of SignatureRunners constructed from this interpreter. Non-blocking and thread safe.

Returns kTfLiteError if cancellation is not enabled via TfLiteInterpreterOptionsEnableCancellation.

Source

pub unsafe fn TfLiteInterpreterGetSignatureCount( &self, interpreter: *const TfLiteInterpreter, ) -> i32

Returns the number of signatures defined in the model.

Source

pub unsafe fn TfLiteInterpreterGetSignatureKey( &self, interpreter: *const TfLiteInterpreter, signature_index: i32, ) -> *const c_char

Returns the key of the Nth signature in the model, where N is specified as signature_index.

NOTE: The lifetime of the returned key is the same as (and depends on) the lifetime of interpreter.

Source

pub unsafe fn TfLiteInterpreterGetSignatureRunner( &self, interpreter: *const TfLiteInterpreter, signature_key: *const c_char, ) -> *mut TfLiteSignatureRunner

Returns a new signature runner using the provided interpreter and signature key, or nullptr on failure.

NOTE: signature_key is a null-terminated C string that must match the key of a signature in the interpreter’s model.

NOTE: The returned signature runner should be destroyed, by calling TfLiteSignatureRunnerDelete(), before the interpreter is destroyed.

Source

pub unsafe fn TfLiteSignatureRunnerGetInputCount( &self, signature_runner: *const TfLiteSignatureRunner, ) -> usize

Returns the number of inputs associated with a signature.

Source

pub unsafe fn TfLiteSignatureRunnerGetInputName( &self, signature_runner: *const TfLiteSignatureRunner, input_index: i32, ) -> *const c_char

Returns the (null-terminated) name of the Nth input in a signature, where N is specified as input_index.

NOTE: The lifetime of the returned name is the same as (and depends on) the lifetime of signature_runner.

Source

pub unsafe fn TfLiteSignatureRunnerResizeInputTensor( &self, signature_runner: *mut TfLiteSignatureRunner, input_name: *const c_char, input_dims: *const c_int, input_dims_size: i32, ) -> TfLiteStatus

Resizes the input tensor identified as input_name to be the dimensions specified by input_dims and input_dims_size. Only unknown dimensions can be resized with this function. Unknown dimensions are indicated as -1 in the dims_signature attribute of a TfLiteTensor.

Returns status of failure or success. Note that this doesn’t actually resize any existing buffers. A call to TfLiteSignatureRunnerAllocateTensors() is required to change the tensor input buffer.

NOTE: This function is similar to TfLiteInterpreterResizeInputTensorStrict() and not TfLiteInterpreterResizeInputTensor().

NOTE: input_name must match the name of an input in the signature.

NOTE: This function makes a copy of the input dimensions, so the caller can safely deallocate input_dims immediately after this function returns.

Source

pub unsafe fn TfLiteSignatureRunnerAllocateTensors( &self, signature_runner: *mut TfLiteSignatureRunner, ) -> TfLiteStatus

Updates allocations for tensors associated with a signature and resizes dependent tensors using the specified input tensor dimensionality. This is a relatively expensive operation and hence should only be called after initializing the signature runner object and/or resizing any inputs.

Source

pub unsafe fn TfLiteSignatureRunnerGetInputTensor( &self, signature_runner: *mut TfLiteSignatureRunner, input_name: *const c_char, ) -> *mut TfLiteTensor

Returns the input tensor identified by input_name in the given signature. Returns nullptr if the given name is not valid.

NOTE: The lifetime of the returned tensor is the same as (and depends on) the lifetime of signature_runner.

Source

pub unsafe fn TfLiteSignatureRunnerInvoke( &self, signature_runner: *mut TfLiteSignatureRunner, ) -> TfLiteStatus

Runs inference on a given signature.

Before calling this function, the caller should first invoke TfLiteSignatureRunnerAllocateTensors() and should also set the values for the input tensors. After successfully calling this function, the values for the output tensors will be set.

Source

pub unsafe fn TfLiteSignatureRunnerGetOutputCount( &self, signature_runner: *const TfLiteSignatureRunner, ) -> usize

Returns the number of output tensors associated with the signature.

Source

pub unsafe fn TfLiteSignatureRunnerGetOutputName( &self, signature_runner: *const TfLiteSignatureRunner, output_index: i32, ) -> *const c_char

Returns the (null-terminated) name of the Nth output in a signature, where N is specified as output_index.

NOTE: The lifetime of the returned name is the same as (and depends on) the lifetime of signature_runner.

Source

pub unsafe fn TfLiteSignatureRunnerGetOutputTensor( &self, signature_runner: *const TfLiteSignatureRunner, output_name: *const c_char, ) -> *const TfLiteTensor

Returns the output tensor identified by output_name in the given signature. Returns nullptr if the given name is not valid.

NOTE: The lifetime of the returned tensor is the same as (and depends on) the lifetime of signature_runner.

Source

pub unsafe fn TfLiteTensorType(&self, tensor: *const TfLiteTensor) -> TfLiteType

Returns the type of a tensor element.

Source

pub unsafe fn TfLiteTensorNumDims(&self, tensor: *const TfLiteTensor) -> i32

Returns the number of dimensions that the tensor has. Returns -1 in case the ‘opaque_tensor’ does not have its dimensions property set.

Source

pub unsafe fn TfLiteTensorDim( &self, tensor: *const TfLiteTensor, dim_index: i32, ) -> i32

Returns the length of the tensor in the “dim_index” dimension. REQUIRES: 0 <= dim_index < TFLiteTensorNumDims(tensor)

Source

pub unsafe fn TfLiteTensorByteSize(&self, tensor: *const TfLiteTensor) -> usize

Returns the size of the underlying data in bytes.

Source

pub unsafe fn TfLiteTensorData( &self, tensor: *const TfLiteTensor, ) -> *mut c_void

Returns a pointer to the underlying data buffer.

\note The result may be null if tensors have not yet been allocated, e.g., if the Tensor has just been created or resized and TfLiteAllocateTensors() has yet to be called, or if the output tensor is dynamically sized and the interpreter hasn’t been invoked.

Source

pub unsafe fn TfLiteTensorName( &self, tensor: *const TfLiteTensor, ) -> *const c_char

Returns the (null-terminated) name of the tensor.

Source

pub unsafe fn TfLiteTensorQuantizationParams( &self, tensor: *const TfLiteTensor, ) -> TfLiteQuantizationParams

Returns the parameters for asymmetric quantization. The quantization parameters are only valid when the tensor type is kTfLiteUInt8 and the scale != 0. Quantized values can be converted back to float using: real_value = scale * (quantized_value - zero_point);

Source

pub unsafe fn TfLiteTensorCopyFromBuffer( &self, tensor: *mut TfLiteTensor, input_data: *const c_void, input_data_size: usize, ) -> TfLiteStatus

Copies from the provided input buffer into the tensor’s buffer. REQUIRES: input_data_size == TfLiteTensorByteSize(tensor)

Source

pub unsafe fn TfLiteTensorCopyToBuffer( &self, output_tensor: *const TfLiteTensor, output_data: *mut c_void, output_data_size: usize, ) -> TfLiteStatus

Copies to the provided output buffer from the tensor’s buffer. REQUIRES: output_data_size == TfLiteTensorByteSize(tensor)

Source

pub unsafe fn TfLiteSignatureRunnerDelete( &self, signature_runner: *mut TfLiteSignatureRunner, )

Destroys the signature runner.

Source

pub unsafe fn TfLiteIntArrayGetSizeInBytes(&self, size: c_int) -> usize

Given the size (number of elements) in a TfLiteIntArray, calculate its size in bytes.

Source

pub unsafe fn TfLiteIntArrayCreate(&self, size: c_int) -> *mut TfLiteIntArray

Create a array of a given size (uninitialized entries). This returns a pointer, that you must free using TfLiteIntArrayFree().

Source

pub unsafe fn TfLiteIntArrayEqual( &self, a: *const TfLiteIntArray, b: *const TfLiteIntArray, ) -> c_int

Check if two intarrays are equal. Returns 1 if they are equal, 0 otherwise.

Source

pub unsafe fn TfLiteIntArrayEqualsArray( &self, a: *const TfLiteIntArray, b_size: c_int, b_data: *const c_int, ) -> c_int

Check if an intarray equals an array. Returns 1 if equals, 0 otherwise.

Source

pub unsafe fn TfLiteIntArrayCopy( &self, src: *const TfLiteIntArray, ) -> *mut TfLiteIntArray

Create a copy of an array passed as src. You are expected to free memory with TfLiteIntArrayFree

Source

pub unsafe fn TfLiteIntArrayFree(&self, a: *mut TfLiteIntArray)

Free memory of array a.

Source

pub unsafe fn TfLiteFloatArrayGetSizeInBytes(&self, size: c_int) -> c_int

Given the size (number of elements) in a TfLiteFloatArray, calculate its size in bytes.

Source

pub unsafe fn TfLiteFloatArrayCreate( &self, size: c_int, ) -> *mut TfLiteFloatArray

Create a array of a given size (uninitialized entries). This returns a pointer, that you must free using TfLiteFloatArrayFree().

Source

pub unsafe fn TfLiteFloatArrayCopy( &self, src: *const TfLiteFloatArray, ) -> *mut TfLiteFloatArray

Create a copy of an array passed as src. You are expected to free memory with TfLiteFloatArrayFree.

Source

pub unsafe fn TfLiteFloatArrayFree(&self, a: *mut TfLiteFloatArray)

Free memory of array a.

Source

pub unsafe fn TfLiteTypeGetName(&self, type_: TfLiteType) -> *const c_char

Return the name of a given type, for error reporting purposes.

Source

pub unsafe fn TfLiteTensorDataFree(&self, t: *mut TfLiteTensor)

Free data memory of tensor t.

Source

pub unsafe fn TfLiteQuantizationFree( &self, quantization: *mut TfLiteQuantization, )

Free quantization data.

Source

pub unsafe fn TfLiteSparsityFree(&self, sparsity: *mut TfLiteSparsity)

Free sparsity parameters.

Source

pub unsafe fn TfLiteTensorFree(&self, t: *mut TfLiteTensor)

Free memory of tensor t.

Source

pub unsafe fn TfLiteTensorReset( &self, type_: TfLiteType, name: *const c_char, dims: *mut TfLiteIntArray, quantization: TfLiteQuantizationParams, buffer: *mut c_char, size: usize, allocation_type: TfLiteAllocationType, allocation: *const c_void, is_variable: bool, tensor: *mut TfLiteTensor, )

Set all of a tensor’s fields (and free any previously allocated data).

Source

pub unsafe fn TfLiteTensorCopy( &self, src: *const TfLiteTensor, dst: *mut TfLiteTensor, ) -> TfLiteStatus

Copies the contents of src in dst. Function does nothing if either src or dst is passed as nullptr and return kTfLiteOk. Returns kTfLiteError if src and dst doesn’t have matching data size. Note function copies contents, so it won’t create new data pointer or change allocation type. All Tensor related properties will be copied from src to dst like quantization, sparsity, …

Source

pub unsafe fn TfLiteTensorResizeMaybeCopy( &self, num_bytes: usize, tensor: *mut TfLiteTensor, preserve_data: bool, ) -> TfLiteStatus

Change the size of the memory block owned by tensor to num_bytes. Tensors with allocation types other than kTfLiteDynamic will be ignored and a kTfLiteOk will be returned. tensor’s internal data buffer will be assigned a pointer which can safely be passed to free or realloc if num_bytes is zero. If preserve_data is true, tensor data will be unchanged in the range from the start of the region up to the minimum of the old and new sizes. In the case of NULL tensor, or an error allocating new memory, returns kTfLiteError.

Source

pub unsafe fn TfLiteTensorRealloc( &self, num_bytes: usize, tensor: *mut TfLiteTensor, ) -> TfLiteStatus

Change the size of the memory block owned by tensor to num_bytes. Tensors with allocation types other than kTfLiteDynamic will be ignored and a kTfLiteOk will be returned. tensor’s internal data buffer will be assigned a pointer which can safely be passed to free or realloc if num_bytes is zero. Tensor data will be unchanged in the range from the start of the region up to the minimum of the old and new sizes. In the case of NULL tensor, or an error allocating new memory, returns kTfLiteError.

Source

pub unsafe fn TfLiteDelegateCreate(&self) -> TfLiteDelegate

Build a null delegate, with all the fields properly set to their default values.

Source

pub unsafe fn TfLiteOpaqueDelegateCreate( &self, opaque_delegate_builder: *const TfLiteOpaqueDelegateBuilder, ) -> *mut TfLiteOpaqueDelegate

Creates an opaque delegate and returns its address. The opaque delegate will behave according to the provided opaque_delegate_builder. The lifetime of the objects pointed to by any of the fields within the opaque_delegate_builder must outlive the returned TfLiteOpaqueDelegate and any TfLiteInterpreter, TfLiteInterpreterOptions, tflite::Interpreter, or tflite::InterpreterBuilder that the delegate is added to. The returned address should be passed to TfLiteOpaqueDelegateDelete for deletion. If opaque_delegate_builder is a null pointer, then a null pointer will be returned.

Source

pub unsafe fn TfLiteOpaqueDelegateDelete( &self, delegate: *mut TfLiteOpaqueDelegate, )

Deletes the provided opaque delegate. This function has no effect if the delegate is a null pointer.

Source

pub unsafe fn TfLiteOpaqueDelegateGetData( &self, delegate: *const TfLiteOpaqueDelegate, ) -> *mut c_void

Returns a pointer to the data associated with the provided opaque delegate.

A null pointer will be returned when:

  • The delegate is null.
  • The data field of the TfLiteOpaqueDelegateBuilder used to construct the delegate was null.
  • Or in case of any other error.
  • The delegate has been constructed via a TfLiteOpaqueDelegateBuilder, but the data field of the TfLiteOpaqueDelegateBuilder is null.

The data_ field of delegate will be returned if the opaque_delegate_builder field is null.

Source

pub unsafe fn TfLiteTensorGetAllocationStrategy( &self, t: *const TfLiteTensor, ) -> TfLiteAllocationStrategy

Returns a tensor data allocation strategy.

Source

pub unsafe fn TfLiteTensorGetBufferAddressStability( &self, t: *const TfLiteTensor, ) -> TfLiteRunStability

Returns how stable a tensor data buffer address is across runs.

Source

pub unsafe fn TfLiteTensorGetDataStability( &self, t: *const TfLiteTensor, ) -> TfLiteRunStability

Returns how stable a tensor data values are across runs.

Source

pub unsafe fn TfLiteTensorGetDataKnownStep( &self, t: *const TfLiteTensor, ) -> TfLiteRunStep

Returns the operation step when the data of a tensor is populated.

Some operations can precompute their results before the evaluation step. This makes the data available earlier for subsequent operations.

Source

pub unsafe fn TfLiteTensorGetShapeKnownStep( &self, t: *const TfLiteTensor, ) -> TfLiteRunStep

Returns the operation steop when the shape of a tensor is computed.

Some operations can precompute the shape of their results before the evaluation step. This makes the shape available earlier for subsequent operations.

Source

pub unsafe fn TfLiteOpaqueTensorType( &self, opaque_tensor: *const TfLiteOpaqueTensor, ) -> TfLiteType

Returns the type of a tensor element.

Source

pub unsafe fn TfLiteOpaqueTensorNumDims( &self, opaque_tensor: *const TfLiteOpaqueTensor, ) -> i32

Returns the number of dimensions that the tensor has. Returns -1 in case the ‘opaque_tensor’ does not have its dimensions property set.

Source

pub unsafe fn TfLiteOpaqueTensorDim( &self, opaque_tensor: *const TfLiteOpaqueTensor, dim_index: i32, ) -> i32

Returns the length of the tensor in the “dim_index” dimension.

Source

pub unsafe fn TfLiteOpaqueTensorGetNumDimsSignature( &self, opaque_tensor: *const TfLiteOpaqueTensor, num_dims: *mut i32, ) -> TfLiteStatus

Loads into the provided ‘num_dims’ the number of dimensions that the tensor’s signature has. Returns ‘kTfLiteOk’ if ‘num_dims’ was successfully loaded. Any other return code indicates an error and ‘num_dims’ won’t be loaded.

A tensor’s dimension signature encodes shapes with unknown dimensions with -1. E.g. for a tensor with three dimensions, whose first dimension has an unknown size, and the second and third dimension have a size of 2, the dimension signature is [-1,2,2], and ‘TfLiteOpaqueTensorGetNumDimsSignature’ loads 3 into ‘num_dims’. If the tensor does not have its dimension signature field set then ‘num_dims’ is set to -1.

Source

pub unsafe fn TfLiteOpaqueTensorGetDimSignature( &self, opaque_tensor: *const TfLiteOpaqueTensor, dim_index: i32, dim_length: *mut i32, ) -> TfLiteStatus

Loads into the provided ‘dim_length’ the length of the tensor in the ‘dim_index’ signature dimension or -1 if that dimension has unknown length. Returns ‘kTfLiteOk’ if ‘dim_length’ was successfully loaded. Any other return code indicates an error and ‘dim_length’ won’t be loaded.

Source

pub unsafe fn TfLiteOpaqueTensorIsVariable( &self, opaque_tensor: *const TfLiteOpaqueTensor, ) -> c_int

Returns ‘non-zero’ if the provided ‘opaque_tensor’ is a variable, and returns zero otherwise.

Source

pub unsafe fn TfLiteOpaqueTensorByteSize( &self, opaque_tensor: *const TfLiteOpaqueTensor, ) -> usize

Returns the size of the underlying data in bytes.

Source

pub unsafe fn TfLiteOpaqueTensorData( &self, opaque_tensor: *const TfLiteOpaqueTensor, ) -> *mut c_void

Returns a pointer to the underlying data buffer. Returns nullptr if input is also nullptr.

Source

pub unsafe fn TfLiteOpaqueTensorGetAllocationType( &self, opaque_tensor: *const TfLiteOpaqueTensor, ) -> TfLiteAllocationType

Returns the ’opaque_tensor’s allocation type.

Source

pub unsafe fn TfLiteOpaqueTensorGetAllocationStrategy( &self, t: *const TfLiteOpaqueTensor, ) -> TfLiteAllocationStrategy

Returns a tensor data allocation strategy.

Source

pub unsafe fn TfLiteOpaqueTensorGetBufferAddressStability( &self, t: *const TfLiteOpaqueTensor, ) -> TfLiteRunStability

Returns how stable a tensor data buffer address is across runs.

Source

pub unsafe fn TfLiteOpaqueTensorGetDataStability( &self, t: *const TfLiteOpaqueTensor, ) -> TfLiteRunStability

Returns how stable a tensor data values are across runs.

Source

pub unsafe fn TfLiteOpaqueTensorGetDataKnownStep( &self, t: *const TfLiteOpaqueTensor, ) -> TfLiteRunStep

Returns the operation step when the data of a tensor is populated.

Source

pub unsafe fn TfLiteOpaqueTensorGetShapeKnownStep( &self, t: *const TfLiteOpaqueTensor, ) -> TfLiteRunStep

Returns the operation step when the shape of a tensor is computed.

Source

pub unsafe fn TfLiteOpaqueTensorName( &self, opaque_tensor: *const TfLiteOpaqueTensor, ) -> *const c_char

Returns the (null-terminated) name of the tensor.

Source

pub unsafe fn TfLiteOpaqueTensorGetQuantization( &self, opaque_tensor: *const TfLiteOpaqueTensor, ) -> TfLiteQuantization

Returns the ’opaque_tensor’s quantization information.

Source

pub unsafe fn TfLiteOpaqueTensorGetQuantizationParams( &self, opaque_tensor: *const TfLiteOpaqueTensor, ) -> TfLiteQuantizationParams

Returns the ’opaque_tensor’s quantization parameters.

Source

pub unsafe fn TfLiteOpaqueTensorCopyFromBuffer( &self, opaque_tensor: *mut TfLiteOpaqueTensor, input_data: *const c_void, input_data_size: usize, ) -> TfLiteStatus

Copies from the provided input buffer into the tensor’s buffer.

Source

pub unsafe fn TfLiteOpaqueTensorCopyToBuffer( &self, opaque_tensor: *const TfLiteOpaqueTensor, output_data: *mut c_void, output_data_size: usize, ) -> TfLiteStatus

Copies to the provided output buffer from the tensor’s buffer.

Source

pub unsafe fn TfLiteOpaqueTensorGetStringCount( &self, tensor: *const TfLiteOpaqueTensor, ) -> c_int

Returns the number of strings stored in the provided ‘tensor’. Returns -1 in case of failure.

Source

pub unsafe fn TfLiteOpaqueTensorGetString( &self, tensor: *const TfLiteOpaqueTensor, index: c_int, str_: *mut *const c_char, len: *mut c_int, ) -> TfLiteStatus

Stores the address of the n-th (denoted by the provided ‘index’) string contained in the provided ‘tensor’ in the provided ‘*str’ pointer. Stores the length of the string in the provided ‘*len’ argument.

Returns ‘kTfLiteOk’ if ‘*str’ and ‘*len’ have been set successfully. Any other return value indicates a failure, which leaves ‘*str’ and ‘*len’ in an unspecified state.

The range of valid indices is defined by the half open interval [0, N), where N == TfLiteOpaqueTensorGetStringCount(tensor).

Note that ‘str’ is not guaranteed to be null-terminated. Also note that this function will not create a copy of the underlying string data. The data is owned by the ‘tensor’.

Source

pub unsafe fn TfLiteOpaqueTensorWriteStrings( &self, tensor: *mut TfLiteOpaqueTensor, str_array: *const *const c_char, str_array_len: c_int, str_n_len: *const c_int, ) -> TfLiteStatus

Writes the array of strings specified by ‘str_array’ into the specified ‘tensor’. The strings provided via the ‘str_array’ are being copied into the ‘tensor’. Returns ‘kTfLiteOk’ in case of success. Any other return value indicates a failure.

The provided ‘str_array_len’ must denote the length of ‘str_array’ and ‘str_n_len[i]’ must denote the length of the i-th string.

The provided strings don’t need to be null terminated and may contain embedded null characters. The amount of bytes copied into the ‘tensor’ is entirely determined by ‘str_n_len[i]’ and it is the caller’s responsibility to set this value correctly to avoid undefined behavior.

Also note that calling ‘TfLiteOpaqueTensorWriteStrings’ deallocates any previously stored data in the ‘tensor’.

Source

pub unsafe fn TfLiteOpaqueTensorWriteString( &self, tensor: *mut TfLiteOpaqueTensor, str_: *const c_char, len: c_int, ) -> TfLiteStatus

Writes the string pointed to by the provided ‘str’ pointer of length ‘len’ into the provided ‘tensor’. The string provided via ‘str’ is copied into the ‘tensor’. Returns ‘kTfLiteOk’ in case of success. Any other return value indicates a failure.

Note that calling ‘TfLiteOpaqueTensorWriteString’ deallocates any previously stored data in the ‘tensor’. E.g. suppose ‘t’ denotes a ‘TfLiteOpaqueTensor*’, then calling ‘TfLiteOpaqueTensorWriteString(t, “AB”, 2)’ followed by a call to ‘TfLiteOpaqueTensorWriteString(t, “CD”, 2)’ will lead to ‘t’ containing ‘CD’, not ‘ABCD’.

‘TfLiteOpaqueTensorWriteString’ is a convenience function for the use case of writing a single string to a tensor and its effects are identical to calling ‘TfLiteOpaqueTensorWriteStrings’ with an array of a single string.

Source

pub unsafe fn TfLiteOpaqueTensorBuilderCreate( &self, ) -> *mut TfLiteOpaqueTensorBuilder

Creates an opaque tensor builder object.

Source

pub unsafe fn TfLiteOpaqueTensorBuilderDelete( &self, builder: *mut TfLiteOpaqueTensorBuilder, )

Deletes an opaque tensor builder object.

Source

pub unsafe fn TfLiteOpaqueTensorBuilderSetType( &self, builder: *mut TfLiteOpaqueTensorBuilder, type_: TfLiteType, ) -> *mut TfLiteOpaqueTensorBuilder

Sets the ‘TfLiteType’ of the provided ‘builder’ to the provided ‘type’. Returns the address of the provided ‘builder’, so that builder calls can be chained together.

Source

pub unsafe fn TfLiteOpaqueTensorBuilderSetData( &self, builder: *mut TfLiteOpaqueTensorBuilder, data: *mut c_void, ) -> *mut TfLiteOpaqueTensorBuilder

Sets the raw data of the provided ‘builder’ to the provided ‘data’. Returns the address of the provided ‘builder’, so that builder calls can be chained together.

Source

pub unsafe fn TfLiteOpaqueTensorBuilderSetAllocationType( &self, builder: *mut TfLiteOpaqueTensorBuilder, allocation_type: TfLiteAllocationType, ) -> *mut TfLiteOpaqueTensorBuilder

Sets the allocation type of the provided ‘builder’ to the provided ‘allocation_type’. The ‘allocation_type’ must be one of the following: ‘kTfLiteDynamic’, ‘kTfLiteArenaRw’ or ‘kTfLiteArenaRwPersistent’. If the provided ‘allocation_type’ is not one of those values then ‘TfLiteOpaqueContextAddTensor’ will return an error. Returns the address of the provided ‘builder’, so that builder calls can be chained together.

Source

pub unsafe fn TfLiteOpaqueTensorBuilderSetQuantizationParams( &self, builder: *mut TfLiteOpaqueTensorBuilder, params: TfLiteQuantizationParams, ) -> *mut TfLiteOpaqueTensorBuilder

Sets the quantization params of the provided ‘builder’ to the provided ‘params’. Returns the address of the provided ‘builder’, so that builder calls can be chained together.

Source

pub unsafe fn TfLiteOpaqueTensorBuilderSetQuantization( &self, builder: *mut TfLiteOpaqueTensorBuilder, quantization: TfLiteQuantization, ) -> *mut TfLiteOpaqueTensorBuilder

Sets the quantization of the provided ‘builder’ to the provided ‘quantization’. Returns the address of the provided ‘builder’, so that builder calls can be chained together.

Source

pub unsafe fn TfLiteOpaqueTensorSetAllocationTypeToDynamic( &self, tensor: *mut TfLiteOpaqueTensor, )

Sets the allocation type of the provided ‘tensor’ to ‘kTfLiteDynamic’. This function has no effect if the ’tensor’s allocation type is already ‘kTfLiteDynamic’. The provided ‘tensor’ must not be null.

Source

pub unsafe fn TfLiteOpaqueNodeGetInput( &self, opaque_context: *const TfLiteOpaqueContext, opaque_node: *const TfLiteOpaqueNode, index: c_int, ) -> *const TfLiteOpaqueTensor

Returns the input tensor of the given node.

Source

pub unsafe fn TfLiteOpaqueNodeGetOutput( &self, opaque_context: *mut TfLiteOpaqueContext, opaque_node: *const TfLiteOpaqueNode, index: c_int, ) -> *mut TfLiteOpaqueTensor

Returns the output tensor of the given node.

Source

pub unsafe fn TfLiteOpaqueNodeNumberOfInputs( &self, opaque_node: *const TfLiteOpaqueNode, ) -> c_int

Gets the number of input tensors of the provided ‘opaque_node’.

Source

pub unsafe fn TfLiteOpaqueNodeNumberOfOutputs( &self, opaque_node: *const TfLiteOpaqueNode, ) -> c_int

Gets the number of output tensors of the provided ‘opaque_node’.

Source

pub unsafe fn TfLiteOpaqueNodeGetUserData( &self, opaque_node: *const TfLiteOpaqueNode, ) -> *mut c_void

Returns opaque data provided by the node implementer. The value returned from this function is the value that was returned from the init callback that was passed to TfLiteOperatorSetInit.

Source

pub unsafe fn TfLiteOpaqueNodeGetBuiltinData( &self, opaque_node: *const TfLiteOpaqueNode, ) -> *mut c_void

Returns the builtin data associated with the provided ‘opaque_node’.

The builtin init data associated with a node would typically be set during the creation of the associated interpreter, through a mechanism like the interpreter builder that loads a TFLite model and initialises the interpreter’s nodes accordingly. Under these conditions the returned address remains valid throughout the lifetime of the ‘opaque_node’.

Source

pub unsafe fn TfLiteOpaqueNodeGetCustomInitialData( &self, opaque_node: *const TfLiteOpaqueNode, init_data: *mut *const c_void, size: *mut c_int, ) -> TfLiteStatus

Loads into the provided ‘*init_data’ pointer the address of the custom init data associated with the provided ‘opaque_node’. The length of data is loaded into the provided ‘size’ pointer. Returns ‘kTfLiteOk’ in case of success. Any other return value indicates a failure and will leave ‘init_data’ and ‘size’ in an unspecified state.

The custom init data associated with a node would typically be set during the creation of the associated interpreter, through a mechanism like the interpreter builder that loads a TFLite model and initialises the interpreter’s nodes accordingly. Under these conditions the returned address remains valid throughout the lifetime of the ‘opaque_node’.

Source

pub unsafe fn TfLiteOpaqueNodeInputs( &self, opaque_node: *const TfLiteOpaqueNode, inputs: *mut *const c_int, num_inputs: *mut c_int, ) -> TfLiteStatus

Loads into the provided ‘*inputs’ pointer the starting address of an array of indices representing the tensors that are inputs of the provided ‘opaque_node’. The length of the array is loaded into the provided ‘num_inputs’ pointer. Returns ‘kTfLiteOk’ in case of success. Any other return value indicates a failure and will leave ‘inputs’ and ‘num_inputs’ in an unspecified state.

The input tensors associated with a node would typically be set during the creation of the associated interpreter, through a mechanism like the interpreter builder that loads a TFLite model and initialises the interpreter’s nodes accordingly. Under these conditions the loaded address remains valid throughout the lifetime of the ‘opaque_node’.

Source

pub unsafe fn TfLiteOpaqueNodeOutputs( &self, opaque_node: *const TfLiteOpaqueNode, outputs: *mut *const c_int, num_outputs: *mut c_int, ) -> TfLiteStatus

Loads into the provided ‘*outputs’ pointer the starting address of an array of indices representing the tensors that are outputs of the provided ‘opaque_node’. The length of the array is loaded into the provided ‘num_outputs’ pointer. Returns ‘kTfLiteOk’ in case of success. Any other return value indicates a failure and will leave ‘outputs’ and ‘num_outputs’ in an unspecified state.

The output tensors associated with a node would typically be set during the creation of the associated interpreter, through a mechanism like the interpreter builder that loads a TFLite model and initialises the interpreter’s nodes accordingly. Under these conditions the loaded address remains valid throughout the lifetime of the ‘opaque_node’.

Source

pub unsafe fn TfLiteOpaqueNodeSetTemporaries( &self, opaque_node: *mut TfLiteOpaqueNode, temporaries: *const c_int, num_temporaries: c_int, ) -> TfLiteStatus

Set tensor indices of temporary tensors used during the computations. These temporary tensors should be allocated using AddTensors(). By default nodes don’t have any temporary tensors, tensors, but ops are allowed to change that if they need scratch space of any sort. This will make a copy of the contents of the array pointed to by temporaries.

Source

pub unsafe fn TfLiteOpaqueNodeTemporaries( &self, opaque_node: *const TfLiteOpaqueNode, temporaries: *mut *const c_int, num_temporaries: *mut c_int, ) -> TfLiteStatus

Loads into the provided ‘*temporaries’ pointer the starting address of an array of indices representing the temporary tensors associated with the provided ‘opaque_node’. The length of the array is loaded into the provided ‘num_temporaries’ pointer. Returns ‘kTfLiteOk’ in case of success. Any other return value indicates a failure and will leave ‘temporaries’ and ‘num_temporaries’ in an unspecified state.

The temporary tensors associated with a node would typically be set during the creation of the associated interpreter, through a mechanism like the interpreter builder that loads a TFLite model and initialises the interpreter’s nodes accordingly. Under these conditions the loaded address remains valid throughout the lifetime of the ‘opaque_node’.

Source

pub unsafe fn TfLiteOpaqueNodeGetInputTensorIndex( &self, opaque_node: *const TfLiteOpaqueNode, index_of_input: c_int, ) -> c_int

Given an ‘index_of_input’, which must be in the range of [0, N), where N is the number of input tensors of the provided ‘opaque_node’, returns the (global) index of the tensor that holds the input. Returns -1 if ‘index_of_input’ is not within the [0, N) range.

Source

pub unsafe fn TfLiteOpaqueNodeGetOutputTensorIndex( &self, opaque_node: *const TfLiteOpaqueNode, index_of_output: c_int, ) -> c_int

Given an ‘index_of_output’, which must be in the range of [0, N), where N is the number of output tensors of the provided ‘opaque_node’, returns the (global) index of the tensor that holds the output. Returns -1 if ‘index_of_output’ is not within the [0, N) range.

Source

pub unsafe fn TfLiteOpaqueContextGetExecutionPlan( &self, opaque_context: *mut TfLiteOpaqueContext, execution_plan: *mut *mut TfLiteIntArray, ) -> TfLiteStatus

Loads the provided execution_plan associated with the provided opaque_context. Returns kTfLiteOk if the execution_plan was successfully loaded. A return value different from kTfLiteOk indicates a failure and the execution_plan will be left in an unspecified state.

Source

pub unsafe fn TfLiteOpaqueContextGetExternalContext( &self, opaque_context: *mut TfLiteOpaqueContext, external_context: *mut *mut c_void, type_: TfLiteExternalContextType, ) -> TfLiteStatus

Returns the external context of the specified type associated with the provided opaque_context. Returns kTfLiteOk if the external context was successfully loaded. A return value different from kTfLiteOk indicates a failure and the external_context will be left in an unspecified state.

Source

pub unsafe fn TfLiteOpaqueContextGetNodeAndRegistration( &self, opaque_context: *mut TfLiteOpaqueContext, node_index: c_int, node: *mut *mut TfLiteOpaqueNode, registration_external: *mut *mut TfLiteOperator, ) -> TfLiteStatus

Given the specified ‘opaque_context’ and ‘node_index’, load the caller’s opaque ‘*node’ and ‘*registration_external’ pointer. Return ‘kTfLiteOk’ if both the ‘*node’ as well as the ‘*registration_external’ have been loaded correctly. Any other return code indicates a failure and both ‘*node’ as well as ‘*registration_external’ will be in an unspecified state.

A caller can obtain a node’s index by calling ‘TfLiteOpaqueContextGetExecutionPlan’, which provides an array of node indices, sorted in execution order. A node index might also come from the data structures passed to the delegate kernel’s callback parameters, like the delegate parameters data structure passed to the ‘init’ callback that contains an array of node indices that are meant to be handled by the delegate kernel.

This function is expected to be called from within a delegate callback, like ‘Prepare’, or a delegate kernel callback (i.e., a callback registered with a ‘TfLiteOperator’ object).

The loaded ‘*node’ and ‘*registration_external’ pointers will generally remain valid for the lifetime of the associated ‘opaque_context’, but can be invalidated through API calls where delegates get un-applied, like API calls that modify the model graph via a delegate, or if input tensors get re-sized.

Source

pub unsafe fn TfLiteOpaqueContextReplaceNodeSubsetsWithDelegateKernels( &self, opaque_context: *mut TfLiteOpaqueContext, registration_external: *mut TfLiteOperator, nodes_to_replace: *const TfLiteIntArray, opaque_delegate: *mut TfLiteOpaqueDelegate, ) -> TfLiteStatus

Entry point for C API ReplaceNodeSubsetsWithDelegateKernels

Replaces the specified nodes_to_replace that are associated with the provided opaque_context with delegate kernels. The provided registration_external represents the delegate kernel and will be used for each node subset that will be delegate to the provided opaque_delegate.

The TF Lite runtime will take ownership of the registration_external and will delete it when the associated opaque_context gets destroyed.

The ownership of the nodes_to_replace and the opaque_delegate remains with the caller.

Source

pub unsafe fn TfLiteOpaqueContextGetOpaqueTensor( &self, opaque_context: *const TfLiteOpaqueContext, index: c_int, ) -> *mut TfLiteOpaqueTensor

Returns modifiable access to the opaque tensor that corresponds to the specified index and is associated with the provided opaque_context.

This requires the index to be between 0 and N - 1, where N is the number of tensors in the model.

Typically the tensors associated with the context would be set during the initialization of the interpreter that the context belongs to, through a mechanism like the InterpreterBuilder, and remain unchanged throughout the lifetime of the interpreter. However, there are some circumstances in which the pointer may not remain valid throughout the lifetime of the interpreter, because calls to AddTensors on the interpreter invalidate the returned pointer.

The ownership of the tensor remains with the TFLite runtime, meaning the caller should not deallocate the pointer.

Source

pub unsafe fn TfLiteOpaqueContextGetInputs( &self, opaque_context: *const TfLiteOpaqueContext, inputs: *mut *const c_int, num_inputs: *mut c_int, ) -> TfLiteStatus

Loads into the provided ‘*inputs’ pointer the starting address of an array of indices representing the tensors that are inputs to the subgraph that is associated with the provided ‘opaque_context’. The length of the array is loaded into the provided ‘num_inputs’ pointer. Returns ‘kTfLiteOk’ in case of success. Any other return value indicates a failure and will leave ‘inputs’ and ‘num_inputs’ in an unspecified state. Calls to ‘SetInputs’ on the associated subgraph invalidate the loaded pointers.

Source

pub unsafe fn TfLiteOpaqueContextGetOutputs( &self, opaque_context: *const TfLiteOpaqueContext, outputs: *mut *const c_int, num_outputs: *mut c_int, ) -> TfLiteStatus

Loads into the provided ‘*outputs’ pointer the starting address of an array of indices representing the tensors that are outputs to the subgraph that is associated with the provided ‘opaque_context’. The length of the array is loaded into the provided ‘num_outputs’ pointer. Returns ‘kTfLiteOk’ in case of success. Any other return value indicates a failure and will leave ‘outputs’ and ‘num_outputs’ in an unspecified state. Calls to ‘SetOutputs’ on the associated subgraph invalidate the loaded pointers.

Source

pub unsafe fn TfLiteOpaqueContextGetVariables( &self, opaque_context: *const TfLiteOpaqueContext, variables: *mut *const c_int, num_variables: *mut c_int, ) -> TfLiteStatus

Loads into the provided ‘*variables’ pointer the starting address of an array of indices representing the tensors that are variables to the subgraph that is associated with the provided ‘opaque_context’. The length of the array is loaded into the provided ‘num_variables’ pointer. Returns ‘kTfLiteOk’ in case of success. Any other return value indicates a failure and will leave ‘variables’ and ‘num_variables’ in an unspecified state. Calls to ‘SetVariables’ on the associated subgraph invalidate the loaded pointers.

Source

pub unsafe fn TfLiteOpaqueContextGetNumNodes( &self, opaque_context: *const TfLiteOpaqueContext, ) -> usize

Returns the number of nodes associated with the provided ‘opaque_context’.

Source

pub unsafe fn TfLiteOpaqueContextGetNumTensors( &self, opaque_context: *const TfLiteOpaqueContext, ) -> usize

Returns the number of tensors associated with the provided ‘opaque_context’.

Source

pub unsafe fn TfLiteOpaqueContextGetName( &self, opaque_context: *const TfLiteOpaqueContext, ) -> *const c_char

Returns the name of the subgraph that is associated with the provided ‘opaque_context’. Typically the returned pointer will remain valid throughout the lifetime of the subgraph, but may be invalidated by a call to ‘Subgraph::SetName’.

Source

pub unsafe fn TfLiteOpaqueContextResizeTensor( &self, context: *mut TfLiteOpaqueContext, tensor: *mut TfLiteOpaqueTensor, new_size: *mut TfLiteIntArray, ) -> TfLiteStatus

Resizes the provided ‘tensor’ that is associated with the provided ‘context’ so that the ’tensor’s shape matches the dimensionality specified via the provided ‘new_size’ array. Returns ‘kTfLiteOk’ in case of success. Any other return value indicates a failure and will leave the ‘tensor’ in an unspecified state. The TF Lite runtime takes ownership of the ‘new_size’ array, even in case of failure.

Source

pub unsafe fn TfLiteOpaqueContextAcquireSubgraphContext( &self, opaque_context: *mut TfLiteOpaqueContext, subgraph_index: c_int, acquired_opaque_context: *mut *mut TfLiteOpaqueContext, ) -> TfLiteStatus

Entry point for C API AcquireSubgraphContext.

Retrieves the corresponding TfLiteOpaqueContext of a subgraph given a subgraph index and switches to the delegate context for this subgraph. If an invalid subgraph index is given, then returns kTfLiteError.

NOTE: This function is expected to be paired with TfLiteOpaqueContextReleaseSubgraphContext() once the delegate preparation is done and/or the delegate context functions are no longer needed.

Source

pub unsafe fn TfLiteOpaqueContextReleaseSubgraphContext( &self, opaque_context: *mut TfLiteOpaqueContext, subgraph_index: c_int, ) -> TfLiteStatus

Entry point for C API ReleaseSubgraphContext.

Releases the corresponding TfLiteOpaqueContext by switching back to the TFLite kernel context for this specified subgraph.

NOTE: This function is expected to be used after TfLiteOpaqueContextAcquireSubgraphContext() once the delegate preparation is done and/or the delegate context functions are no longer needed.

Source

pub unsafe fn TfLiteOpaqueContextMarkSubgraphAsDelegationSkippable( &self, opaque_context: *mut TfLiteOpaqueContext, subgraph_index: c_int, ) -> TfLiteStatus

Entry point for C API MarkSubgraphAsDelegationSkippable

Marks the subgraph with the given index as “delegation-skippable”. Returns kTfLiteOk if the given subgraph index is valid and is successfully marked as delegation-skippable, and an error status if the subgraph index is invalid. If a subgraph is delegation-skippable, then the subgraph will be handled by a specific TfLiteOpaqueDelegate that is already supposed to be aware of this condition, and therefore, TfLiteInterpreter can skip invoking ModifyGraphWithDelegate on this subgraph.

NOTE: This function is expected to be called only when the subgraph that subgraph_index is pointing to should be skipped by interpreter::ModifyGraphWithDelegate (e.g. the subgraph is part of the list of callee subgraphs of the same control flow node, and all of those callees are supported by the same delegate at once).

For example, this function can be used when the delegate is handling control flow ops such as while ops. For instance, a while op has a condition subgraph indexed at i and a body subgraph indexed at j. The op can be delegated when the following conditions hold:

  1. The delegate supports while op
  2. Both condition subgraph i and body subgraph j can be fully delegated to the delegate.

Then if the delegate decides to support the while node along with both body and condition subgraphs, it should mark subgraphs i and j skippable so that those two subgraphs won’t be delegated to another delegate.

WARNING: It is the delegate’s responsibility to define when to skip Subgraph::ModifyGraphWithDelegate, to check for any edge cases (i.e. multiple references to the subgraph that subgraph_index is pointing to), and to mark a subgraph as skippable by using this function.

Source

pub unsafe fn TfLiteOpaqueContextGetNodeInitDataMmapInfo( &self, context: *const TfLiteOpaqueContext, node: *const TfLiteOpaqueNode, fd: *mut c_int, custom_initial_data_offset_in_file: *mut i64, custom_initial_data_size: *mut i64, ) -> TfLiteStatus

Loads metadata of a TF Lite node’s custom initialization data. Specifically:

  • Loads into the supplied ‘fd’ the file descriptor of the file that stores the ’node’s custom initialization data. This output parameter will be loaded if the TF Lite runtime has access to the file descriptor, though this is not always the case, e.g. if a client provides a tflite::Model directly to the TF Lite runtime. If ‘fd’ can be loaded then ‘kTfLiteOk’ will be returned, otherwise ‘kTfLiteError’ is returned.
  • Loads into the supplied ‘custom_initial_data_offset_in_file’ pointer the offset of the ’node’s custom init data in the file associated with ‘fd’. This output parameter will be set to -1 if the ‘node’ does not have custom init data set.
  • Loads into the supplied ‘custom_initial_data_size’ the size of the custom initialization data. This output parameter will be set to -1 if the ‘node’ does not have custom init data set.

Returns ‘kTfLiteOk’ when ‘fd’ has been loaded successfully and ‘kTfLiteError’ otherwise. Note that this means that ‘kTfLiteOk’ can be returned, even if the ‘node’ does not have custom init data set.

Source

pub unsafe fn TfLiteOpaqueContextAddTensor( &self, context: *mut TfLiteOpaqueContext, builder: *mut TfLiteOpaqueTensorBuilder, new_tensor_index: *mut c_int, ) -> TfLiteStatus

Adds an additional tensor and configures its properties based on the provided ‘builder’, preserving pre-existing Tensor entries. If non-null, the value pointed to by ‘new_tensor_index’ will be set to the index of the new tensor. Returns ‘kTfLiteOk’ when the tensor has been added successfully. Returns ‘kTfLiteError’ in case of failure.

Source

pub unsafe fn TfLiteOpaqueContextGetSizeOfType( &self, context: *mut TfLiteOpaqueContext, type_: TfLiteType, bytes: *mut usize, ) -> TfLiteStatus

Populates the size in bytes of a provide ‘type’ into ‘bytes’. Returns ‘kTfLiteOk’ for valid types, and ‘kTfLiteError’ otherwise.

Source

pub unsafe fn TfLiteOpaqueContextGetMetadata( &self, context: *mut TfLiteOpaqueContext, name: *const c_char, ptr: *mut *const c_char, bytes: *mut usize, ) -> TfLiteStatus

Retrieves named metadata buffer from the TFLite model. Returns kTfLiteOk if metadata is successfully obtained from the flatbuffer model. That is, there exists a metadata entry with given name string. (see TFLite’s schema.fbs). The corresponding buffer information is populated in ptr & bytes. The data from ptr is valid for the lifetime of the Interpreter.

Source

pub unsafe fn TfLiteOpaqueContextReportErrorVa( &self, opaque_context: *mut TfLiteOpaqueContext, format: *const c_char, vlist: *mut __va_list_tag, )

Same as TfLiteOpaqueContextReportError, but with the variable arguments passed via a va_list instead of directly.

Callers that receive an ellipsis and want to forward it to to the opaque context error reporting API can add the ellipsis content to a va_list and then call TfLiteOpaqueContextReportErrorVa. E.g.:

     void MyErrorReporter(struct TfLiteOpaqueContext* opaque_context,
                                      const char* format, ...) {
       va_list vlist;
       va_start(vlist, format);
       TfLiteOpaqueContextReportErrorVa(opaque_context, format, vlist);
       va_end(vlist);
     }
Source§

impl tensorflowlite_c

Source

pub fn library(&self) -> &Library

Returns a reference to the underlying libloading::Library.

This is an escape hatch for loading optional symbols (e.g., XNNPACK) that live inside the main TFLite shared library rather than a separate delegate .so.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.