14 #if !defined(INCLUDED_AILIA_TFLITE)
15 #define INCLUDED_AILIA_TFLITE
27 struct AILIATFLiteInstance;
33 struct AILIATFLiteSubCoreControlVariables;
48 #define AILIA_TFLITE_TENSOR_TYPE_FLOAT32 (0)
58 #define AILIA_TFLITE_TENSOR_TYPE_FLOAT16 (1)
68 #define AILIA_TFLITE_TENSOR_TYPE_INT32 (2)
78 #define AILIA_TFLITE_TENSOR_TYPE_UINT8 (3)
88 #define AILIA_TFLITE_TENSOR_TYPE_INT64 (4)
98 #define AILIA_TFLITE_TENSOR_TYPE_STRING (5)
108 #define AILIA_TFLITE_TENSOR_TYPE_BOOL (6)
118 #define AILIA_TFLITE_TENSOR_TYPE_INT16 (7)
128 #define AILIA_TFLITE_TENSOR_TYPE_COMPLEX64 (8)
138 #define AILIA_TFLITE_TENSOR_TYPE_INT8 (9)
154 #define AILIA_TFLITE_STATUS_SUCCESS ( 0)
164 #define AILIA_TFLITE_STATUS_INVALID_ARGUMENT ( -1)
174 #define AILIA_TFLITE_STATUS_OUT_OF_RANGE ( -2)
184 #define AILIA_TFLITE_STATUS_MEMORY_INSUFFICIENT ( -3)
194 #define AILIA_TFLITE_STATUS_BROKEN_MODEL ( -4)
204 #define AILIA_TFLITE_STATUS_INVALID_PARAMETER ( -5)
214 #define AILIA_TFLITE_STATUS_PARAMETER_NOT_FOUND ( -6)
224 #define AILIA_TFLITE_STATUS_UNSUPPORTED_OPCODE ( -7)
234 #define AILIA_TFLITE_STATUS_LICENSE_NOT_FOUND ( -8)
244 #define AILIA_TFLITE_STATUS_LICENSE_BROKEN ( -9)
254 #define AILIA_TFLITE_STATUS_LICENSE_EXPIRED ( -10)
264 #define AILIA_TFLITE_STATUS_INVALID_STATE ( -11)
274 #define AILIA_TFLITE_STATUS_OTHER_ERROR (-128)
290 #define AILIA_TFLITE_ENV_REFERENCE (0)
300 #define AILIA_TFLITE_ENV_NNAPI (1)
310 #define AILIA_TFLITE_ENV_MMALIB (2)
320 #define AILIA_TFLITE_ENV_MMALIB_COMPATIBLE (3)
331 #define AILIA_TFLITE_ENV_QNN (4)
346 #define AILIA_TFLITE_MEMORY_MODE_DEFAULT (0)
356 #define AILIA_TFLITE_MEMORY_MODE_REDUCE_INTERSTAGE (1)
372 #define AILIA_TFLITE_PROFILE_MODE_DISABLE (0)
383 #define AILIA_TFLITE_PROFILE_MODE_ENABLE (1)
394 #define AILIA_TFLITE_PROFILE_MODE_TRACE (2)
405 #define AILIA_TFLITE_PROFILE_MODE_MEMORY (4)
420 #define AILIA_TFLITE_FLAG_NONE (0)
431 #define AILIA_TFLITE_FLAG_INPUT_AND_OUTPUT_TENSORS_USE_SCRATCH (1)
448 #define AILIA_TFLITE_CPU_FEATURES_NONE (0x00000000)
458 #define AILIA_TFLITE_CPU_FEATURES_NEON (0x00000001)
468 #define AILIA_TFLITE_CPU_FEATURES_SSE2 (0x00000002)
478 #define AILIA_TFLITE_CPU_FEATURES_SSE4_2 (0x00000004)
488 #define AILIA_TFLITE_CPU_FEATURES_AVX (0x00000008)
498 #define AILIA_TFLITE_CPU_FEATURES_AVX2 (0x00000010)
508 #define AILIA_TFLITE_CPU_FEATURES_VNNI (0x00000020)
518 #define AILIA_TFLITE_CPU_FEATURES_AVX512 (0x00000040)
528 #define AILIA_TFLITE_CPU_FEATURES_I8MM (0x00000080)
539 #define AILIA_TFLITE_SUB_CORE_COUNT_MAX (8)
633 ailiaTFLiteCreate(
struct AILIATFLiteInstance **instance,
const void * tflite,
const size_t tflite_length,
void *(*pmalloc)(
size_t,
const void *,
void *),
void *(*pmemcpy)(
void *,
const void *,
size_t,
void *),
void (*pfree)(
void *,
void *),
void *phandle,
AILIATFLiteEnvironment env_id,
AILIATFLiteMemoryMode memory_mode,
AILIATFLiteFlags flags);
1572 ailiaTFLiteSetScratchBuffer(
struct AILIATFLiteInstance *instance,
void *int_buffer,
size_t int_buffer_size,
void *mid_buffer,
size_t mid_buffer_size,
void *ext_buffer,
size_t ext_buffer_size);
1670 int (*pmain_after_command_store)(
void*),
int (*pmain_before_state_load)(
void*));
AILIATFLiteStatus ailiaTFLiteCreate(struct AILIATFLiteInstance **instance, const void *tflite, const size_t tflite_length, void *(*pmalloc)(size_t, const void *, void *), void *(*pmemcpy)(void *, const void *, size_t, void *), void(*pfree)(void *, void *), void *phandle, AILIATFLiteEnvironment env_id, AILIATFLiteMemoryMode memory_mode, AILIATFLiteFlags flags)
Create ailia TFLite runtime instances.
AILIATFLiteStatus ailiaTFLiteGetNodeOperator(const struct AILIATFLiteInstance *instance, int32_t *op, const int32_t node_index)
Get node_index number Operator.
int32_t AILIATFLiteFlags
Definition: ailia_tflite.h:433
AILIATFLiteStatus ailiaTFLiteGetEnvironmentCount(size_t *env_count)
Get the number of available calculation environments.
void ailiaTFLiteDestroy(struct AILIATFLiteInstance *instance)
Discard the instance of ailia TFLite runtime.
AILIATFLiteStatus ailiaTFLiteResizeInputTensor(struct AILIATFLiteInstance *instance, const int32_t input_index, const int32_t *shape, const int32_t dim)
Change the shape of Tensor of the specified input index.
AILIATFLiteStatus ailiaTFLiteGetSummaryLength(struct AILIATFLiteInstance *instance, size_t *buffer_size)
Get the size of the buffer required for network Summary.
AILIATFLiteStatus ailiaTFLiteGetNodeInputCount(const struct AILIATFLiteInstance *instance, int32_t *count, const int32_t node_index)
Node_index gets the number of node input.
AILIATFLiteStatus ailiaTFLiteGetNodeCount(const struct AILIATFLiteInstance *instance, int32_t *count)
Get the number of node.
AILIATFLiteStatus ailiaTFLiteGetNodeOutputTensorIndex(const struct AILIATFLiteInstance *instance, int32_t *tensor_index, const int32_t node_index, const int32_t output_index)
Node_index Acquire the index of Tensor in the Output_index number of node.
AILIATFLiteStatus ailiaTFLiteGetInputTensorIndex(const struct AILIATFLiteInstance *instance, int32_t *tensor_index, const int32_t input_index)
Get Tensor's index from index in Tensor.
AILIATFLiteStatus ailiaTFLiteGetErrorDetail(struct AILIATFLiteInstance *instance, char **buffer)
Returns the error details.
AILIATFLiteStatus ailiaTFLiteGetTensorQuantizationZeroPoint(const struct AILIATFLiteInstance *instance, int64_t *zero_point, const int32_t tensor_index)
Get the zero point of the quantified parameter of the index number TENSOR.
AILIATFLiteStatus ailiaTFLiteSetSynchronizeFunctions(struct AILIATFLiteInstance *instance, int(*pmain_after_command_store)(void *), int(*pmain_before_state_load)(void *))
const char * ailiaTFLiteGetVersion(void)
Get the version of the library.
AILIATFLiteStatus alilaTFLiteSetSubCoreControlVariables(struct AILIATFLiteInstance *instance, const struct AILIATFLiteSubCoreControlVariables *control_variables, int32_t sub_core_count)
When using multi-core systems, set the variables used to communicate with each subcore.
AILIATFLiteStatus ailiaTFLiteGetTensorName(const struct AILIATFLiteInstance *instance, const char **name, const int32_t tensor_index)
Get the name of the index number Tensor.
AILIATFLiteStatus ailiaTFLiteGetTensorQuantizationQuantizedDimension(const struct AILIATFLiteInstance *instance, int32_t *axis, const int32_t tensor_index)
Get the axis of the integrated TENSOR quantization parameter.
AILIATFLiteStatus ailiaTFLiteGetOutputTensorIndex(const struct AILIATFLiteInstance *instance, int32_t *tensor_index, const int32_t output_index)
Obtain Tensor's index from index of output Tensor.
AILIATFLiteStatus ailiaTFLiteGetTensorDimension(const struct AILIATFLiteInstance *instance, int32_t *tensor_dim, const int32_t tensor_index)
Get the dimension of index number Tensor.
AILIATFLiteStatus ailiaTFLiteGetTensorShapeSignature(const struct AILIATFLiteInstance *instance, int32_t *shape, const int32_t tensor_index)
Get the undecided dimensional form of Tensor of index number.
AILIATFLiteStatus ailiaTFLiteGetNodeOption(const struct AILIATFLiteInstance *instance, void *value, const int32_t node_index, const char *key)
Node_index gets the Node option.
AILIATFLiteStatus ailiaTFLiteGetTensorQuantizationScale(const struct AILIATFLiteInstance *instance, float *scale, const int32_t tensor_index)
Get the scale of the quantified parameter of the index number TENSOR.
AILIATFLiteStatus ailiaTFLiteGetNumberOfInputs(const struct AILIATFLiteInstance *instance, int32_t *num_of_input_tensor)
Get the number of TENSOR in the TFLITE model.
int32_t AILIATFLiteMemoryMode
Definition: ailia_tflite.h:357
AILIATFLiteStatus ailiaTFLiteGetSummary(struct AILIATFLiteInstance *instance, char *buffer, size_t buffer_size)
Displays the name and shape of each node.
AILIATFLiteStatus ailiaTFLiteMklDisableFastMM(void)
Disable the mkl fastmm.
AILIATFLiteStatus ailiaTFLiteGetNodeOutputCount(const struct AILIATFLiteInstance *instance, int32_t *count, const int32_t node_index)
Node_index gets the number of node output.
AILIATFLiteStatus ailiaTFLiteGetCpuFeatures(struct AILIATFLiteInstance *instance, int32_t *cpu_features)
Get the CPU instruction to use.
AILIATFLiteStatus ailiaTFLiteGetTensorType(const struct AILIATFLiteInstance *instance, AILIATFLiteTensorType *tensor_type, const int32_t tensor_index)
Get the Data type of TENSOR in Index.
AILIATFLiteStatus ailiaTFLitePredict(struct AILIATFLiteInstance *instance)
Do inference.
AILIATFLiteStatus ailiaTFLiteGetEnvironment(AILIATFLiteEnvironment *env)
Get a list of calculation environments.
AILIATFLiteStatus ailiaTFLiteGetTensorQuantizationCount(const struct AILIATFLiteInstance *instance, int32_t *count, const int32_t tensor_index)
Get the number of quantified parameters of index number Tensor.
AILIATFLiteStatus ailiaTFLiteGetNumberOfOutputs(const struct AILIATFLiteInstance *instance, int32_t *num_of_output_tensor)
Get the number of TENSOR of the TFLITE model.
AILIATFLiteStatus ailiaTFLiteGetScratchBufferUsage(struct AILIATFLiteInstance *instance, size_t *int_buffer_size, size_t *mid_buffer_size, size_t *ext_buffer_size)
Get the maximum usage of the scratch buffer.
AILIATFLiteStatus ailiaTFLiteGetOperatorName(const char **name, const int32_t op)
Get the Operator name.
AILIATFLiteStatus ailiaTFLiteSetCpuFeatures(struct AILIATFLiteInstance *instance, int32_t cpu_features)
Set the CPU instruction to use.
AILIATFLiteStatus ailiaTFLiteAllocateTensors(struct AILIATFLiteInstance *instance)
Ensure the internal buffer of ailia TFLite runtime.
AILIATFLiteStatus ailiaTFLiteMklSetNumThreads(const int32_t num_threads)
Set the number of threads used by MKL.
int32_t AILIATFLiteEnvironment
Definition: ailia_tflite.h:321
int8_t AILIATFLiteTensorType
Definition: ailia_tflite.h:139
AILIATFLiteStatus ailiaTFLiteGetNodeInputTensorIndex(const struct AILIATFLiteInstance *instance, int32_t *tensor_index, const int32_t node_index, const int32_t input_index)
Node_index Acquires the index of Tensor in the input input of node.
AILIATFLiteStatus ailiaTFLiteGetTensorBuffer(struct AILIATFLiteInstance *instance, void **buffer, const int32_t tensor_index)
Obtain a storage buffer in Tensor's data.
AILIATFLiteStatus ailiaTFLiteSetProfileMode(struct AILIATFLiteInstance *instance, int mode)
Set the profile mode.
AILIATFLiteStatus ailiaTFLiteSetScratchBuffer(struct AILIATFLiteInstance *instance, void *int_buffer, size_t int_buffer_size, void *mid_buffer, size_t mid_buffer_size, void *ext_buffer, size_t ext_buffer_size)
Set a scratch buffer.
int32_t AILIATFLiteCpuFeatures
Definition: ailia_tflite.h:541
AILIATFLiteStatus ailiaTFLiteGetTensorShape(const struct AILIATFLiteInstance *instance, int32_t *shape, const int32_t tensor_index)
Get the shape of the index number Tensor.
int32_t AILIATFLiteStatus
Definition: ailia_tflite.h:275