#![allow(non_camel_case_types)]
use std::os::raw::{c_char, c_int, c_void};
#[repr(C)]
pub struct TfLiteModel {
_private: [u8; 0],
}
#[repr(C)]
pub struct TfLiteInterpreterOptions {
_private: [u8; 0],
}
#[repr(C)]
pub struct TfLiteInterpreter {
_private: [u8; 0],
}
#[repr(C)]
pub struct TfLiteTensor {
_private: [u8; 0],
}
#[repr(C)]
pub struct TfLiteDelegate {
_private: [u8; 0],
}
#[repr(C)]
pub struct TfLiteExternalDelegateOptions {
_private: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum TfLiteStatus {
Ok = 0,
Error = 1,
DelegateError = 2,
ApplicationError = 3,
DelegateDataNotFound = 4,
DelegateDataWriteError = 5,
DelegateDataReadError = 6,
UnresolvedOps = 7,
Cancelled = 8,
OutputShapeNotKnown = 9,
}
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum TfLiteType {
NoType = 0,
Float32 = 1,
Int32 = 2,
UInt8 = 3,
Int64 = 4,
String = 5,
Bool = 6,
Int16 = 7,
Complex64 = 8,
Int8 = 9,
Float16 = 10,
Float64 = 11,
Complex128 = 12,
UInt64 = 13,
Resource = 14,
Variant = 15,
UInt32 = 16,
UInt16 = 17,
Int4 = 18,
BFloat16 = 19,
}
#[repr(C)]
#[derive(Debug, Clone, Copy, Default)]
pub struct TfLiteQuantizationParams {
pub scale: f32,
pub zero_point: i32,
}
pub type ModelCreateFromFileFn = unsafe extern "C" fn(*const c_char) -> *mut TfLiteModel;
pub type ModelDeleteFn = unsafe extern "C" fn(*mut TfLiteModel);
pub type OptionsCreateFn = unsafe extern "C" fn() -> *mut TfLiteInterpreterOptions;
pub type OptionsDeleteFn = unsafe extern "C" fn(*mut TfLiteInterpreterOptions);
pub type OptionsSetNumThreadsFn =
unsafe extern "C" fn(*mut TfLiteInterpreterOptions, c_int);
pub type OptionsAddDelegateFn =
unsafe extern "C" fn(*mut TfLiteInterpreterOptions, *mut TfLiteDelegate);
pub type InterpreterCreateFn = unsafe extern "C" fn(
*const TfLiteModel,
*const TfLiteInterpreterOptions,
) -> *mut TfLiteInterpreter;
pub type InterpreterDeleteFn = unsafe extern "C" fn(*mut TfLiteInterpreter);
pub type InterpreterAllocateTensorsFn =
unsafe extern "C" fn(*mut TfLiteInterpreter) -> TfLiteStatus;
pub type InterpreterInvokeFn = unsafe extern "C" fn(*mut TfLiteInterpreter) -> TfLiteStatus;
pub type InterpreterGetTensorCountFn =
unsafe extern "C" fn(*const TfLiteInterpreter) -> c_int;
pub type InterpreterGetInputTensorFn =
unsafe extern "C" fn(*const TfLiteInterpreter, c_int) -> *mut TfLiteTensor;
pub type InterpreterGetOutputTensorFn =
unsafe extern "C" fn(*const TfLiteInterpreter, c_int) -> *const TfLiteTensor;
pub type TensorTypeFn = unsafe extern "C" fn(*const TfLiteTensor) -> TfLiteType;
pub type TensorNumDimsFn = unsafe extern "C" fn(*const TfLiteTensor) -> c_int;
pub type TensorDimFn = unsafe extern "C" fn(*const TfLiteTensor, c_int) -> c_int;
pub type TensorByteSizeFn = unsafe extern "C" fn(*const TfLiteTensor) -> usize;
pub type TensorDataFn = unsafe extern "C" fn(*const TfLiteTensor) -> *mut c_void;
pub type TensorNameFn = unsafe extern "C" fn(*const TfLiteTensor) -> *const c_char;
pub type TensorQuantizationParamsFn =
unsafe extern "C" fn(*const TfLiteTensor) -> TfLiteQuantizationParams;
pub type ExternalDelegateOptionsCreateFn =
unsafe extern "C" fn() -> *mut TfLiteExternalDelegateOptions;
pub type ExternalDelegateOptionsDeleteFn =
unsafe extern "C" fn(*mut TfLiteExternalDelegateOptions);
pub type ExternalDelegateOptionsSetLibraryPathFn =
unsafe extern "C" fn(*mut TfLiteExternalDelegateOptions, *const c_char) -> TfLiteStatus;
pub type ExternalDelegateOptionsInsertFn = unsafe extern "C" fn(
*mut TfLiteExternalDelegateOptions,
*const c_char,
*const c_char,
) -> TfLiteStatus;
pub type ExternalDelegateCreateFn =
unsafe extern "C" fn(*const TfLiteExternalDelegateOptions) -> *mut TfLiteDelegate;
pub type ExternalDelegateDeleteFn = unsafe extern "C" fn(*mut TfLiteDelegate);