ailia_tflite  1.2.2.0
Macros | Typedefs | Functions
ailia_tflite.h File Reference

AILIA TFLITE RUNTIME INTERFACE. More...

#include <stdint.h>
#include <stddef.h>
Include dependency graph for ailia_tflite.h:

Go to the source code of this file.

Macros

#define AILIA_TFLITE_TENSOR_TYPE_FLOAT32   (0)
 FLOAT32. More...
 
#define AILIA_TFLITE_TENSOR_TYPE_FLOAT16   (1)
 FLOAT16. More...
 
#define AILIA_TFLITE_TENSOR_TYPE_INT32   (2)
 INT32. More...
 
#define AILIA_TFLITE_TENSOR_TYPE_UINT8   (3)
 UINT8. More...
 
#define AILIA_TFLITE_TENSOR_TYPE_INT64   (4)
 INT64. More...
 
#define AILIA_TFLITE_TENSOR_TYPE_STRING   (5)
 STRING. More...
 
#define AILIA_TFLITE_TENSOR_TYPE_BOOL   (6)
 BOOL. More...
 
#define AILIA_TFLITE_TENSOR_TYPE_INT16   (7)
 INT16. More...
 
#define AILIA_TFLITE_TENSOR_TYPE_COMPLEX64   (8)
 COMPLEX64. More...
 
#define AILIA_TFLITE_TENSOR_TYPE_INT8   (9)
 INT8. More...
 
#define AILIA_TFLITE_STATUS_SUCCESS   ( 0)
 成功 More...
 
#define AILIA_TFLITE_STATUS_INVALID_ARGUMENT   ( -1)
 If the argument is fraudulent, if the status code is returned, review the caller code or the argument passed in NULL. More...
 
#define AILIA_TFLITE_STATUS_OUT_OF_RANGE   ( -2)
 If the argument is out of range. returns this status code, please review whether the argument is out of the range. More...
 
#define AILIA_TFLITE_STATUS_MEMORY_INSUFFICIENT   ( -3)
 This status code, which has a shortage of memory, is returned when the memory is secured.Check the availability of the memory and take action, such as terminating other processes. More...
 
#define AILIA_TFLITE_STATUS_BROKEN_MODEL   ( -4)
 This status code, which is damaged by the model, is returned when the given model file is damaged.Please check if the model file is correct. More...
 
#define AILIA_TFLITE_STATUS_INVALID_PARAMETER   ( -5)
 The model parameter is fraudulent This status code returns when the parameters contained in the model are fraudulent.Please check if the model file is correct. More...
 
#define AILIA_TFLITE_STATUS_PARAMETER_NOT_FOUND   ( -6)
 This status code without parameters is returned when the specified parameter does not exist in the model.Please check if the code or model file of the caller is correct. More...
 
#define AILIA_TFLITE_STATUS_UNSUPPORTED_OPCODE   ( -7)
 This status code, which tried to run a non -brief -compatible operator, is returned when the ailia TFLite runtime is not supported.Make sure that the model is not included in the model other than the operator listed in the document.Please contact the documentary contact information for the addition of a new operator. More...
 
#define AILIA_TFLITE_STATUS_LICENSE_NOT_FOUND   ( -8)
 This status code is not found in this status code when the trial version ailia TFLite runtime is running and if the license file is not found.For the trial version license, please contact the documentary inquiry. More...
 
#define AILIA_TFLITE_STATUS_LICENSE_BROKEN   ( -9)
 This status code, which is broken, is returned when the license file is damaged when the trial version ailia TFLite runtime is running.For the trial version license, please contact the documentary inquiry. More...
 
#define AILIA_TFLITE_STATUS_LICENSE_EXPIRED   ( -10)
 License expired status code is returned when the license file is expired when the trial version ailia TFLite runtime is running.Please contact the documentary contact information for updating the trial version license. More...
 
#define AILIA_TFLITE_STATUS_INVALID_STATE   ( -11)
 If this status code, which is not a state that can call the API, returns, review whether it can call the API. More...
 
#define AILIA_TFLITE_STATUS_OTHER_ERROR   (-128)
 Returns when an error other than the above occurs.Please contact us to the contact information described in the documentation. More...
 
#define AILIA_TFLITE_ENV_REFERENCE   (0)
 Reference CPU implementation. More...
 
#define AILIA_TFLITE_ENV_NNAPI   (1)
 Implementation using NNAPI.For Android. More...
 
#define AILIA_TFLITE_ENV_MMALIB   (2)
 Implementation using mmalib.The PC uses mmalib emulator, and mmalib is used for the device. More...
 
#define AILIA_TFLITE_ENV_MMALIB_COMPATIBLE   (3)
 MMALIB output compatible implementation.It operates at high speed to perform only the output match. More...
 
#define AILIA_TFLITE_ENV_QNN   (4)
 Implementation using QNN. More...
 
#define AILIA_TFLITE_MEMORY_MODE_DEFAULT   (0)
 Normal mode. More...
 
#define AILIA_TFLITE_MEMORY_MODE_REDUCE_INTERSTAGE   (1)
 Low Memory mode. More...
 
#define AILIA_TFLITE_PROFILE_MODE_DISABLE   (0)
 Profile disabled. More...
 
#define AILIA_TFLITE_PROFILE_MODE_ENABLE   (1)
 Profile enabled. More...
 
#define AILIA_TFLITE_PROFILE_MODE_TRACE   (2)
 Trace enabled. More...
 
#define AILIA_TFLITE_PROFILE_MODE_MEMORY   (4)
 Memory profile enabled. More...
 
#define AILIA_TFLITE_FLAG_NONE   (0)
 Normal mode. More...
 
#define AILIA_TFLITE_FLAG_INPUT_AND_OUTPUT_TENSORS_USE_SCRATCH   (1)
 
#define AILIA_TFLITE_CPU_FEATURES_NONE   (0x00000000)
 CPU extension disabled. More...
 
#define AILIA_TFLITE_CPU_FEATURES_NEON   (0x00000001)
 NEON. More...
 
#define AILIA_TFLITE_CPU_FEATURES_SSE2   (0x00000002)
 SSE2. More...
 
#define AILIA_TFLITE_CPU_FEATURES_SSE4_2   (0x00000004)
 SSE4.2. More...
 
#define AILIA_TFLITE_CPU_FEATURES_AVX   (0x00000008)
 AVX. More...
 
#define AILIA_TFLITE_CPU_FEATURES_AVX2   (0x00000010)
 AVX2. More...
 
#define AILIA_TFLITE_CPU_FEATURES_VNNI   (0x00000020)
 VNNI. More...
 
#define AILIA_TFLITE_CPU_FEATURES_AVX512   (0x00000040)
 AVX512. More...
 
#define AILIA_TFLITE_CPU_FEATURES_I8MM   (0x00000080)
 I8MM. More...
 
#define AILIA_TFLITE_SUB_CORE_COUNT_MAX   (8)
 The maximum number of cores in multicore environments. More...
 

Typedefs

typedef int8_t AILIATFLiteTensorType
 
typedef int32_t AILIATFLiteStatus
 
typedef int32_t AILIATFLiteEnvironment
 
typedef int32_t AILIATFLiteMemoryMode
 
typedef int32_t AILIATFLiteFlags
 
typedef int32_t AILIATFLiteCpuFeatures
 

Functions

AILIATFLiteStatus ailiaTFLiteGetEnvironmentCount (size_t *env_count)
 Get the number of available calculation environments. More...
 
AILIATFLiteStatus ailiaTFLiteGetEnvironment (AILIATFLiteEnvironment *env)
 Get a list of calculation environments. More...
 
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. More...
 
void ailiaTFLiteDestroy (struct AILIATFLiteInstance *instance)
 Discard the instance of ailia TFLite runtime. More...
 
AILIATFLiteStatus ailiaTFLiteGetCpuFeatures (struct AILIATFLiteInstance *instance, int32_t *cpu_features)
 Get the CPU instruction to use. More...
 
AILIATFLiteStatus ailiaTFLiteSetCpuFeatures (struct AILIATFLiteInstance *instance, int32_t cpu_features)
 Set the CPU instruction to use. More...
 
AILIATFLiteStatus ailiaTFLiteAllocateTensors (struct AILIATFLiteInstance *instance)
 Ensure the internal buffer of ailia TFLite runtime. More...
 
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. More...
 
AILIATFLiteStatus ailiaTFLiteGetNumberOfInputs (const struct AILIATFLiteInstance *instance, int32_t *num_of_input_tensor)
 Get the number of TENSOR in the TFLITE model. More...
 
AILIATFLiteStatus ailiaTFLiteGetInputTensorIndex (const struct AILIATFLiteInstance *instance, int32_t *tensor_index, const int32_t input_index)
 Get Tensor's index from index in Tensor. More...
 
AILIATFLiteStatus ailiaTFLiteGetNumberOfOutputs (const struct AILIATFLiteInstance *instance, int32_t *num_of_output_tensor)
 Get the number of TENSOR of the TFLITE model. More...
 
AILIATFLiteStatus ailiaTFLiteGetOutputTensorIndex (const struct AILIATFLiteInstance *instance, int32_t *tensor_index, const int32_t output_index)
 Obtain Tensor's index from index of output Tensor. More...
 
AILIATFLiteStatus ailiaTFLiteGetTensorDimension (const struct AILIATFLiteInstance *instance, int32_t *tensor_dim, const int32_t tensor_index)
 Get the dimension of index number Tensor. More...
 
AILIATFLiteStatus ailiaTFLiteGetTensorShape (const struct AILIATFLiteInstance *instance, int32_t *shape, const int32_t tensor_index)
 Get the shape of the index number Tensor. More...
 
AILIATFLiteStatus ailiaTFLiteGetTensorShapeSignature (const struct AILIATFLiteInstance *instance, int32_t *shape, const int32_t tensor_index)
 Get the undecided dimensional form of Tensor of index number. More...
 
AILIATFLiteStatus ailiaTFLiteGetTensorType (const struct AILIATFLiteInstance *instance, AILIATFLiteTensorType *tensor_type, const int32_t tensor_index)
 Get the Data type of TENSOR in Index. More...
 
AILIATFLiteStatus ailiaTFLiteGetTensorBuffer (struct AILIATFLiteInstance *instance, void **buffer, const int32_t tensor_index)
 Obtain a storage buffer in Tensor's data. More...
 
AILIATFLiteStatus ailiaTFLiteGetTensorName (const struct AILIATFLiteInstance *instance, const char **name, const int32_t tensor_index)
 Get the name of the index number Tensor. More...
 
AILIATFLiteStatus ailiaTFLiteGetTensorQuantizationCount (const struct AILIATFLiteInstance *instance, int32_t *count, const int32_t tensor_index)
 Get the number of quantified parameters of index number Tensor. More...
 
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. More...
 
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. More...
 
AILIATFLiteStatus ailiaTFLiteGetTensorQuantizationQuantizedDimension (const struct AILIATFLiteInstance *instance, int32_t *axis, const int32_t tensor_index)
 Get the axis of the integrated TENSOR quantization parameter. More...
 
AILIATFLiteStatus ailiaTFLitePredict (struct AILIATFLiteInstance *instance)
 Do inference. More...
 
AILIATFLiteStatus ailiaTFLiteGetNodeCount (const struct AILIATFLiteInstance *instance, int32_t *count)
 Get the number of node. More...
 
AILIATFLiteStatus ailiaTFLiteGetNodeOperator (const struct AILIATFLiteInstance *instance, int32_t *op, const int32_t node_index)
 Get node_index number Operator. More...
 
AILIATFLiteStatus ailiaTFLiteGetNodeInputCount (const struct AILIATFLiteInstance *instance, int32_t *count, const int32_t node_index)
 Node_index gets the number of node input. More...
 
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. More...
 
AILIATFLiteStatus ailiaTFLiteGetNodeOutputCount (const struct AILIATFLiteInstance *instance, int32_t *count, const int32_t node_index)
 Node_index gets the number of node output. More...
 
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. More...
 
AILIATFLiteStatus ailiaTFLiteGetNodeOption (const struct AILIATFLiteInstance *instance, void *value, const int32_t node_index, const char *key)
 Node_index gets the Node option. More...
 
AILIATFLiteStatus ailiaTFLiteGetOperatorName (const char **name, const int32_t op)
 Get the Operator name. More...
 
AILIATFLiteStatus ailiaTFLiteSetProfileMode (struct AILIATFLiteInstance *instance, int mode)
 Set the profile mode. More...
 
AILIATFLiteStatus ailiaTFLiteGetSummaryLength (struct AILIATFLiteInstance *instance, size_t *buffer_size)
 Get the size of the buffer required for network Summary. More...
 
AILIATFLiteStatus ailiaTFLiteGetSummary (struct AILIATFLiteInstance *instance, char *buffer, size_t buffer_size)
 Displays the name and shape of each node. More...
 
AILIATFLiteStatus ailiaTFLiteGetErrorDetail (struct AILIATFLiteInstance *instance, char **buffer)
 Returns the error details. More...
 
const char * ailiaTFLiteGetVersion (void)
 Get the version of the library. More...
 
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. More...
 
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. More...
 
AILIATFLiteStatus ailiaTFLiteMklSetNumThreads (const int32_t num_threads)
 Set the number of threads used by MKL. More...
 
AILIATFLiteStatus ailiaTFLiteMklDisableFastMM (void)
 Disable the mkl fastmm. More...
 
AILIATFLiteStatus ailiaTFLiteSetSynchronizeFunctions (struct AILIATFLiteInstance *instance, int(*pmain_after_command_store)(void *), int(*pmain_before_state_load)(void *))
 
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. More...
 

Detailed Description

AILIA TFLITE RUNTIME INTERFACE.

Date
January 26, 2024

Macro Definition Documentation

◆ AILIA_TFLITE_CPU_FEATURES_AVX

#define AILIA_TFLITE_CPU_FEATURES_AVX   (0x00000008)

AVX.

◆ AILIA_TFLITE_CPU_FEATURES_AVX2

#define AILIA_TFLITE_CPU_FEATURES_AVX2   (0x00000010)

AVX2.

◆ AILIA_TFLITE_CPU_FEATURES_AVX512

#define AILIA_TFLITE_CPU_FEATURES_AVX512   (0x00000040)

AVX512.

◆ AILIA_TFLITE_CPU_FEATURES_I8MM

#define AILIA_TFLITE_CPU_FEATURES_I8MM   (0x00000080)

I8MM.

◆ AILIA_TFLITE_CPU_FEATURES_NEON

#define AILIA_TFLITE_CPU_FEATURES_NEON   (0x00000001)

NEON.

◆ AILIA_TFLITE_CPU_FEATURES_NONE

#define AILIA_TFLITE_CPU_FEATURES_NONE   (0x00000000)

CPU extension disabled.

◆ AILIA_TFLITE_CPU_FEATURES_SSE2

#define AILIA_TFLITE_CPU_FEATURES_SSE2   (0x00000002)

SSE2.

◆ AILIA_TFLITE_CPU_FEATURES_SSE4_2

#define AILIA_TFLITE_CPU_FEATURES_SSE4_2   (0x00000004)

SSE4.2.

◆ AILIA_TFLITE_CPU_FEATURES_VNNI

#define AILIA_TFLITE_CPU_FEATURES_VNNI   (0x00000020)

VNNI.

◆ AILIA_TFLITE_ENV_MMALIB

#define AILIA_TFLITE_ENV_MMALIB   (2)

Implementation using mmalib.The PC uses mmalib emulator, and mmalib is used for the device.

◆ AILIA_TFLITE_ENV_MMALIB_COMPATIBLE

#define AILIA_TFLITE_ENV_MMALIB_COMPATIBLE   (3)

MMALIB output compatible implementation.It operates at high speed to perform only the output match.

◆ AILIA_TFLITE_ENV_NNAPI

#define AILIA_TFLITE_ENV_NNAPI   (1)

Implementation using NNAPI.For Android.

◆ AILIA_TFLITE_ENV_QNN

#define AILIA_TFLITE_ENV_QNN   (4)

Implementation using QNN.

◆ AILIA_TFLITE_ENV_REFERENCE

#define AILIA_TFLITE_ENV_REFERENCE   (0)

Reference CPU implementation.

◆ AILIA_TFLITE_FLAG_INPUT_AND_OUTPUT_TENSORS_USE_SCRATCH

#define AILIA_TFLITE_FLAG_INPUT_AND_OUTPUT_TENSORS_USE_SCRATCH   (1)

◆ AILIA_TFLITE_FLAG_NONE

#define AILIA_TFLITE_FLAG_NONE   (0)

Normal mode.

◆ AILIA_TFLITE_MEMORY_MODE_DEFAULT

#define AILIA_TFLITE_MEMORY_MODE_DEFAULT   (0)

Normal mode.

◆ AILIA_TFLITE_MEMORY_MODE_REDUCE_INTERSTAGE

#define AILIA_TFLITE_MEMORY_MODE_REDUCE_INTERSTAGE   (1)

Low Memory mode.

◆ AILIA_TFLITE_PROFILE_MODE_DISABLE

#define AILIA_TFLITE_PROFILE_MODE_DISABLE   (0)

Profile disabled.

◆ AILIA_TFLITE_PROFILE_MODE_ENABLE

#define AILIA_TFLITE_PROFILE_MODE_ENABLE   (1)

Profile enabled.

◆ AILIA_TFLITE_PROFILE_MODE_MEMORY

#define AILIA_TFLITE_PROFILE_MODE_MEMORY   (4)

Memory profile enabled.

◆ AILIA_TFLITE_PROFILE_MODE_TRACE

#define AILIA_TFLITE_PROFILE_MODE_TRACE   (2)

Trace enabled.

◆ AILIA_TFLITE_STATUS_BROKEN_MODEL

#define AILIA_TFLITE_STATUS_BROKEN_MODEL   ( -4)

This status code, which is damaged by the model, is returned when the given model file is damaged.Please check if the model file is correct.

◆ AILIA_TFLITE_STATUS_INVALID_ARGUMENT

#define AILIA_TFLITE_STATUS_INVALID_ARGUMENT   ( -1)

If the argument is fraudulent, if the status code is returned, review the caller code or the argument passed in NULL.

◆ AILIA_TFLITE_STATUS_INVALID_PARAMETER

#define AILIA_TFLITE_STATUS_INVALID_PARAMETER   ( -5)

The model parameter is fraudulent This status code returns when the parameters contained in the model are fraudulent.Please check if the model file is correct.

◆ AILIA_TFLITE_STATUS_INVALID_STATE

#define AILIA_TFLITE_STATUS_INVALID_STATE   ( -11)

If this status code, which is not a state that can call the API, returns, review whether it can call the API.

◆ AILIA_TFLITE_STATUS_LICENSE_BROKEN

#define AILIA_TFLITE_STATUS_LICENSE_BROKEN   ( -9)

This status code, which is broken, is returned when the license file is damaged when the trial version ailia TFLite runtime is running.For the trial version license, please contact the documentary inquiry.

◆ AILIA_TFLITE_STATUS_LICENSE_EXPIRED

#define AILIA_TFLITE_STATUS_LICENSE_EXPIRED   ( -10)

License expired status code is returned when the license file is expired when the trial version ailia TFLite runtime is running.Please contact the documentary contact information for updating the trial version license.

◆ AILIA_TFLITE_STATUS_LICENSE_NOT_FOUND

#define AILIA_TFLITE_STATUS_LICENSE_NOT_FOUND   ( -8)

This status code is not found in this status code when the trial version ailia TFLite runtime is running and if the license file is not found.For the trial version license, please contact the documentary inquiry.

◆ AILIA_TFLITE_STATUS_MEMORY_INSUFFICIENT

#define AILIA_TFLITE_STATUS_MEMORY_INSUFFICIENT   ( -3)

This status code, which has a shortage of memory, is returned when the memory is secured.Check the availability of the memory and take action, such as terminating other processes.

◆ AILIA_TFLITE_STATUS_OTHER_ERROR

#define AILIA_TFLITE_STATUS_OTHER_ERROR   (-128)

Returns when an error other than the above occurs.Please contact us to the contact information described in the documentation.

◆ AILIA_TFLITE_STATUS_OUT_OF_RANGE

#define AILIA_TFLITE_STATUS_OUT_OF_RANGE   ( -2)

If the argument is out of range. returns this status code, please review whether the argument is out of the range.

◆ AILIA_TFLITE_STATUS_PARAMETER_NOT_FOUND

#define AILIA_TFLITE_STATUS_PARAMETER_NOT_FOUND   ( -6)

This status code without parameters is returned when the specified parameter does not exist in the model.Please check if the code or model file of the caller is correct.

◆ AILIA_TFLITE_STATUS_SUCCESS

#define AILIA_TFLITE_STATUS_SUCCESS   ( 0)

成功

◆ AILIA_TFLITE_STATUS_UNSUPPORTED_OPCODE

#define AILIA_TFLITE_STATUS_UNSUPPORTED_OPCODE   ( -7)

This status code, which tried to run a non -brief -compatible operator, is returned when the ailia TFLite runtime is not supported.Make sure that the model is not included in the model other than the operator listed in the document.Please contact the documentary contact information for the addition of a new operator.

◆ AILIA_TFLITE_SUB_CORE_COUNT_MAX

#define AILIA_TFLITE_SUB_CORE_COUNT_MAX   (8)

The maximum number of cores in multicore environments.

◆ AILIA_TFLITE_TENSOR_TYPE_BOOL

#define AILIA_TFLITE_TENSOR_TYPE_BOOL   (6)

BOOL.

◆ AILIA_TFLITE_TENSOR_TYPE_COMPLEX64

#define AILIA_TFLITE_TENSOR_TYPE_COMPLEX64   (8)

COMPLEX64.

◆ AILIA_TFLITE_TENSOR_TYPE_FLOAT16

#define AILIA_TFLITE_TENSOR_TYPE_FLOAT16   (1)

FLOAT16.

◆ AILIA_TFLITE_TENSOR_TYPE_FLOAT32

#define AILIA_TFLITE_TENSOR_TYPE_FLOAT32   (0)

FLOAT32.

◆ AILIA_TFLITE_TENSOR_TYPE_INT16

#define AILIA_TFLITE_TENSOR_TYPE_INT16   (7)

INT16.

◆ AILIA_TFLITE_TENSOR_TYPE_INT32

#define AILIA_TFLITE_TENSOR_TYPE_INT32   (2)

INT32.

◆ AILIA_TFLITE_TENSOR_TYPE_INT64

#define AILIA_TFLITE_TENSOR_TYPE_INT64   (4)

INT64.

◆ AILIA_TFLITE_TENSOR_TYPE_INT8

#define AILIA_TFLITE_TENSOR_TYPE_INT8   (9)

INT8.

◆ AILIA_TFLITE_TENSOR_TYPE_STRING

#define AILIA_TFLITE_TENSOR_TYPE_STRING   (5)

STRING.

◆ AILIA_TFLITE_TENSOR_TYPE_UINT8

#define AILIA_TFLITE_TENSOR_TYPE_UINT8   (3)

UINT8.

Typedef Documentation

◆ AILIATFLiteCpuFeatures

typedef int32_t AILIATFLiteCpuFeatures

◆ AILIATFLiteEnvironment

typedef int32_t AILIATFLiteEnvironment

◆ AILIATFLiteFlags

typedef int32_t AILIATFLiteFlags

◆ AILIATFLiteMemoryMode

typedef int32_t AILIATFLiteMemoryMode

◆ AILIATFLiteStatus

typedef int32_t AILIATFLiteStatus

◆ AILIATFLiteTensorType

typedef int8_t AILIATFLiteTensorType

Function Documentation

◆ ailiaTFLiteAllocateTensors()

AILIATFLiteStatus ailiaTFLiteAllocateTensors ( struct AILIATFLiteInstance *  instance)

Ensure the internal buffer of ailia TFLite runtime.

Parameters
instanceailia TFLite runtime instance pointer
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If you fail, return AILIA_TFLITE_STATUS_XXX.

Update the internal shape and secure the buffer required for inference.

◆ ailiaTFLiteCreate()

AILIATFLiteStatus ailiaTFLiteCreate ( struct AILIATFLiteInstance **  instance,
const void *  tflite,
const size_t  tflite_length,
void *(*)(size_t, const void *, void *)  pmalloc,
void *(*)(void *, const void *, size_t, void *)  pmemcpy,
void(*)(void *, void *)  pfree,
void *  phandle,
AILIATFLiteEnvironment  env_id,
AILIATFLiteMemoryMode  memory_mode,
AILIATFLiteFlags  flags 
)

Create ailia TFLite runtime instances.

Parameters
instanceailia TFLite runtime Pointter to instance pointer
tflitePointter to TFLITE model
tflite_lengthTFLITE length (byte unit)
pmallocMALLOC function pointer (use malloc in the case of null)
pmemcpyMEMCPY function pointer (use Memcpy for null)
pfreeFREE function pointer (use free in the case of null)
phandleHandle passed to Memoria Locator (NULL when using standard allocator)
env_idProgress execution environment used for calculation (AILIA_TFLITE_ENV_NAPI_*)
memory_modeMemory mode (AILIA_TFLITE_MEMORY_MODE_*)
flagsFlag (logical sum of AILIA_TFLITE_FLAG_*)
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If you fail, return AILIA_TFLITE_STATUS_XXX.

Open the TFLITE model and create ailia TFLite runtime instances. We will also secure the necessary internal buffers. If the instance fails, you need to call AILIATFLITEDESTROY if you store anything other than NULL in Instance.

◆ ailiaTFLiteDestroy()

void ailiaTFLiteDestroy ( struct AILIATFLiteInstance *  instance)

Discard the instance of ailia TFLite runtime.

Parameters
instanceailia TFLite runtime instance pointer

◆ ailiaTFLiteGetCpuFeatures()

AILIATFLiteStatus ailiaTFLiteGetCpuFeatures ( struct AILIATFLiteInstance *  instance,
int32_t *  cpu_features 
)

Get the CPU instruction to use.

Parameters
instanceailia TFLite runtime instance pointer
cpu_featuresAILIA_TFLITE_CPU_FEATURES_XXX logical sum
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If you fail, return AILIA_TFLITE_STATUS_XXX.

Get the CPU instruction to use. By default, it returns the CPU instruction obtained from the CPU information. After calling ailiaTFLiteSetCpuFeatures, return the set CPU instruction.

◆ ailiaTFLiteGetEnvironment()

AILIATFLiteStatus ailiaTFLiteGetEnvironment ( AILIATFLiteEnvironment env)

Get a list of calculation environments.

Parameters
envArrangement of storage destination of calculation environmental information
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If you fail, return AILIA_TFLITE_STATUS_XXX.

Give the size of the ailiaTFLiteGetEnvironmentCount() to input to the input.

◆ ailiaTFLiteGetEnvironmentCount()

AILIATFLiteStatus ailiaTFLiteGetEnvironmentCount ( size_t *  env_count)

Get the number of available calculation environments.

Parameters
env_countPointter to the number of calculation environment information
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If you fail, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetErrorDetail()

AILIATFLiteStatus ailiaTFLiteGetErrorDetail ( struct AILIATFLiteInstance *  instance,
char **  buffer 
)

Returns the error details.

Parameters
instanceailia TFLite runtime instance pointer
bufferError detailed pointer to string

The string does not need to be released. The validity period of the string is to call the AILIA API.

◆ ailiaTFLiteGetInputTensorIndex()

AILIATFLiteStatus ailiaTFLiteGetInputTensorIndex ( const struct AILIATFLiteInstance *  instance,
int32_t *  tensor_index,
const int32_t  input_index 
)

Get Tensor's index from index in Tensor.

Parameters
instanceailia TFLite runtime instance pointer
tensor_indexPointer to the destination of Tensor's index
input_indexINDEX of input Tensor (0 ~ Number of input Tensor-1)
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If INPUT_INDEX is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

Convert from index in Tensor to index of Tensor. The upper limit of INDEX is ailiaTFLiteGetNumberOfInputs() -1.

◆ ailiaTFLiteGetNodeCount()

AILIATFLiteStatus ailiaTFLiteGetNodeCount ( const struct AILIATFLiteInstance *  instance,
int32_t *  count 
)

Get the number of node.

Parameters
instanceailia TFLite runtime instance pointer
countPointter to the number of node stored
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetNodeInputCount()

AILIATFLiteStatus ailiaTFLiteGetNodeInputCount ( const struct AILIATFLiteInstance *  instance,
int32_t *  count,
const int32_t  node_index 
)

Node_index gets the number of node input.

Parameters
instanceailia TFLite runtime instance pointer
countPointter to the storage destination of the number of input
node_indexNode index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If node_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetNodeInputTensorIndex()

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.

Parameters
instanceailia TFLite runtime instance pointer
tensor_indexPointer to the destination of Tensor's index
node_indexNode index
input_indexINDEX for input
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If node_index and input_index are out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetNodeOperator()

AILIATFLiteStatus ailiaTFLiteGetNodeOperator ( const struct AILIATFLiteInstance *  instance,
int32_t *  op,
const int32_t  node_index 
)

Get node_index number Operator.

Parameters
instanceailia TFLite runtime instance pointer
opPointter to the destination of Operator
node_indexNode index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If node_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

The ENUM value of Operator is the same as the internal value of the TFLite file. For more information, see TensorFlow/Lite/Schema/Schema.fbs files in TensorFlow source tree.

◆ ailiaTFLiteGetNodeOption()

AILIATFLiteStatus ailiaTFLiteGetNodeOption ( const struct AILIATFLiteInstance *  instance,
void *  value,
const int32_t  node_index,
const char *  key 
)

Node_index gets the Node option.

Parameters
instanceaILIA TFLITE RUNTIME instance pointer
valuePointter to the storage destination of the output
node_indexNode index
keyOptional name string pointer
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If node_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetNodeOutputCount()

AILIATFLiteStatus ailiaTFLiteGetNodeOutputCount ( const struct AILIATFLiteInstance *  instance,
int32_t *  count,
const int32_t  node_index 
)

Node_index gets the number of node output.

Parameters
instanceailia TFLite runtime instance pointer
countPointter to the storage destination of the number of output
node_indexNode index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If node_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetNodeOutputTensorIndex()

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.

Parameters
instanceailia TFLite runtime instance pointer
tensor_indexPointer to the destination of Tensor's index
node_indexNode index
output_indexOutput index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If node_index and output_index are out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetNumberOfInputs()

AILIATFLiteStatus ailiaTFLiteGetNumberOfInputs ( const struct AILIATFLiteInstance *  instance,
int32_t *  num_of_input_tensor 
)

Get the number of TENSOR in the TFLITE model.

Parameters
instanceailia TFLite runtime instance pointer
num_of_input_tensorPointter to the number of model input TENSOR
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If you fail, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetNumberOfOutputs()

AILIATFLiteStatus ailiaTFLiteGetNumberOfOutputs ( const struct AILIATFLiteInstance *  instance,
int32_t *  num_of_output_tensor 
)

Get the number of TENSOR of the TFLITE model.

Parameters
instanceailia TFLite runtime instance pointer
num_of_output_tensorPointter to the number of model output TENSOR
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If you fail, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetOperatorName()

AILIATFLiteStatus ailiaTFLiteGetOperatorName ( const char **  name,
const int32_t  op 
)

Get the Operator name.

Parameters
namePointter to the destination of the string pointer with the name of Operator
opOperator
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

The life of the character string pointer that can be obtained in Name is effective until the library unload. There is no need to open the string pointer at the caller.

◆ ailiaTFLiteGetOutputTensorIndex()

AILIATFLiteStatus ailiaTFLiteGetOutputTensorIndex ( const struct AILIATFLiteInstance *  instance,
int32_t *  tensor_index,
const int32_t  output_index 
)

Obtain Tensor's index from index of output Tensor.

Parameters
instanceailia TFLite runtime instance pointer
tensor_indexPointer to the destination of Tensor's index
output_indexOutput TENSOR index (0 ~ Number of output Tensor-1)
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If output_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

Convert from Index in Tensor to Tensor Index. The upper limit of INDEX is ailiaTFLiteGetNumberOfOutputs () -1.

◆ ailiaTFLiteGetScratchBufferUsage()

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.

Parameters
instanceailia TFLite runtime instance pointer
int_buffer_sizeSize of scratch buffer (L2)
mid_buffer_sizeSize of scratch buffer (MSMC)
ext_buffer_sizeSize of scratch buffer (DDR)

You can get the size of the necessary scratch buffer by inferring in the first large scratch buffer size. Since the value considering the alignment performed inside is returned, the acquired value can be used directly without considering the alignment.

◆ ailiaTFLiteGetSummary()

AILIATFLiteStatus ailiaTFLiteGetSummary ( struct AILIATFLiteInstance *  instance,
char *  buffer,
size_t  buffer_size 
)

Displays the name and shape of each node.

Parameters
instanceailia TFLite runtime instance pointer
bufferSUMMARY output string pointer
buffer_sizeThe size of the output buffer (including the terminal NULL character).Set the value obtained by AILIATFLITITEGETSUMMARYLENGTH ().
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetSummaryLength()

AILIATFLiteStatus ailiaTFLiteGetSummaryLength ( struct AILIATFLiteInstance *  instance,
size_t *  buffer_size 
)

Get the size of the buffer required for network Summary.

Parameters
instanceailia TFLite runtime instance pointer
buffer_sizePointter to the storage destination of the size of the buffer (including the terminal NULL character)
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetTensorBuffer()

AILIATFLiteStatus ailiaTFLiteGetTensorBuffer ( struct AILIATFLiteInstance *  instance,
void **  buffer,
const int32_t  tensor_index 
)

Obtain a storage buffer in Tensor's data.

Parameters
instanceailia TFLite runtime instance pointer
bufferPointter to the destination of the pointer to the data storage buffer
tensor_indexTensor's index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If Tensor_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

The life of the storage buffer that can be obtained with Buffer is valid until either ailiaTFLiteAllocateTensors/ailiaTFLiteResizeInputTensor/ailiaTFLiteDestroy is called. The value of the storage buffer is changed when ailiaTFLitePredict is called. There is no need to open the storage buffer at the caller.

◆ ailiaTFLiteGetTensorDimension()

AILIATFLiteStatus ailiaTFLiteGetTensorDimension ( const struct AILIATFLiteInstance *  instance,
int32_t *  tensor_dim,
const int32_t  tensor_index 
)

Get the dimension of index number Tensor.

Parameters
instanceailia TFLite runtime instance pointer
tensor_dimPointter to the specified Tensor's dimension
tensor_indexTensor's index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If Tensor_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetTensorName()

AILIATFLiteStatus ailiaTFLiteGetTensorName ( const struct AILIATFLiteInstance *  instance,
const char **  name,
const int32_t  tensor_index 
)

Get the name of the index number Tensor.

Parameters
instanceailia TFLite runtime instance pointer
namePointter to the destination of the character string pointer named Tensor
tensor_indexTensor's index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If Tensor_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

The life of the string pointer that can be obtained in name is effective until calling ailiaTFLiteDestroy. There is no need to open the string pointer at the caller.

◆ ailiaTFLiteGetTensorQuantizationCount()

AILIATFLiteStatus ailiaTFLiteGetTensorQuantizationCount ( const struct AILIATFLiteInstance *  instance,
int32_t *  count,
const int32_t  tensor_index 
)

Get the number of quantified parameters of index number Tensor.

Parameters
instanceailia TFLite runtime instance pointer
countPointter to the number of quantified parameters
tensor_indexTensor's index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If Tensor_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

Get the number of quantified parameters associated with the specified Tensor. If there is no quantization parameter in the specified Tensor, 0 is stored.

◆ ailiaTFLiteGetTensorQuantizationQuantizedDimension()

AILIATFLiteStatus ailiaTFLiteGetTensorQuantizationQuantizedDimension ( const struct AILIATFLiteInstance *  instance,
int32_t *  axis,
const int32_t  tensor_index 
)

Get the axis of the integrated TENSOR quantization parameter.

Parameters
instanceailia TFLite runtime instance pointer
axisPointter to the destination of the axis of the quantized parameter
tensor_indexTensor's index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If Tensor_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. If the quantized parameter does not exist in the specified Tensor, AILIA_TFLITE_STATUS_PARAMETER_NOT_FOUND is returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetTensorQuantizationScale()

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.

Parameters
instanceailia TFLite runtime instance pointer
scalePointter to the storage destination of the quantized parameter
tensor_indexTensor's index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If Tensor_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. If the quantized parameter does not exist in the specified Tensor, AILIA_TFLITE_STATUS_PARAMETER_NOT_FOUND is returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

Tensor is quantized and stored in the following formula. Quantization value = zero_point * round(input/scale) Acquired by scale: ailiaTFLiteGetTensorQuantizationScale Acquired by zero_point: ailiaTFliteGetTensorQuantizationZeroPoint scale should secure more than the number of elements obtained in ailiaTFLiteGetTensorQuantizationCount.

◆ ailiaTFLiteGetTensorQuantizationZeroPoint()

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.

Parameters
instanceailia TFLite runtime instance pointer
zero_pointPointter to the destination of zero points of quantization parameters
tensor_indexTensor's index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If Tensor_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. If the quantized parameter does not exist in the specified Tensor, AILIA_TFLITE_STATUS_PARAMETER_NOT_FOUND is returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

See ailiaTFLiteGetTensorQuantizationScale for description of quantification. For zero_point, secure a buffer that is more than the number of elements acquired in ailiaTFLiteGetTensorQuantizationCountで.

◆ ailiaTFLiteGetTensorShape()

AILIATFLiteStatus ailiaTFLiteGetTensorShape ( const struct AILIATFLiteInstance *  instance,
int32_t *  shape,
const int32_t  tensor_index 
)

Get the shape of the index number Tensor.

Parameters
instanceailia TFLite runtime instance pointer
shapeTensor shape storage destination
tensor_indexTensor's index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If Tensor_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

Store the shape of the specified Tensor in Shape. Shape should secure a buffer that is more than the dimensions acquired by ailiaTFLiteGetTensorDimension.

◆ ailiaTFLiteGetTensorShapeSignature()

AILIATFLiteStatus ailiaTFLiteGetTensorShapeSignature ( const struct AILIATFLiteInstance *  instance,
int32_t *  shape,
const int32_t  tensor_index 
)

Get the undecided dimensional form of Tensor of index number.

Parameters
instanceailia TFLite runtime instance pointer
shapeTensor shape storage destination
tensor_indexTensor's index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If Tensor_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

Store the undecided dimensional information of the specified Tensor in Shape. -1 is stored for dimensions with undecided shape. If the specified Tensor does not contain an undecided dimension, it will be the same result as ailiaTFLiteGetTensorShape. Shape should secure a buffer that is more than the dimensions acquired by ailiaTFLiteGetTensorDimension.

◆ ailiaTFLiteGetTensorType()

AILIATFLiteStatus ailiaTFLiteGetTensorType ( const struct AILIATFLiteInstance *  instance,
AILIATFLiteTensorType tensor_type,
const int32_t  tensor_index 
)

Get the Data type of TENSOR in Index.

Parameters
instanceailia TFLite runtime instance pointer
tensor_typeSpecified TENSOR data type storage destination
tensor_indexTensor's index
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If Tensor_index is out of range, AILIA_TFLITE_STATUS_OUT_OF_RANGE will be returned. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteGetVersion()

const char* ailiaTFLiteGetVersion ( void  )

Get the version of the library.

Returns
Version number

The return value does not have to be released.

◆ ailiaTFLiteMklDisableFastMM()

AILIATFLiteStatus ailiaTFLiteMklDisableFastMM ( void  )

Disable the mkl fastmm.

Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If you fail, return AILIA_TFLITE_STATUS_XXX.

mkl_disable_fast_mm is called to disable FastMM.It affects all instances. Mkl increases the memory monotonously until mkl_Free_buffers is called to secure memory for each thread. This work memory is kept until mkl_Free_buffers is called in ailiaTFLiteDestroy. By disabling the fastmm, you can specify not to secure memory for each thread. In an environment that does not use Mkl (MacOS, etc.), return AILIA_TFLITE_STATUS_INVALID_STATE.

◆ ailiaTFLiteMklSetNumThreads()

AILIATFLiteStatus ailiaTFLiteMklSetNumThreads ( const int32_t  num_threads)

Set the number of threads used by MKL.

Parameters
num_threadsNumber of threads (1 or more)
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If you fail, return AILIA_TFLITE_STATUS_XXX.

Change the MKL thread number by calling mkl_set_num_threads.It affects all instances. By default, it will be automatically set. In an environment that does not use Mkl (MacOS, etc.), return AILIA_TFLITE_STATUS_INVALID_STATE.

◆ ailiaTFLitePredict()

AILIATFLiteStatus ailiaTFLitePredict ( struct AILIATFLiteInstance *  instance)

Do inference.

Parameters
instanceailia TFLite runtime instance pointer
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If you fail, return AILIA_TFLITE_STATUS_XXX.

◆ ailiaTFLiteResizeInputTensor()

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.

Parameters
instanceailia TFLite runtime instance pointer
input_index0 ~ Input Tensor number-1
shapeNew shape
dimdimension
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If the specified Tensor does not contain an undecided dimension, return AILIA_TFLITE_STATUS_FIXED_TENSOR. If you fail, return AILIA_TFLITE_STATUS_XXX.

Change the shape of the input Tensor. Calling this function to open the secured internal buffer You need to call ailiaTFLiteAllocateTensors. Also, since the shape of the intermediate Tensor may change depending on the input shape. After calling this function, the results of the acquisition API may be fraudulent until the ailiaTFLiteAllocateTensors is called. The upper limit of INDEX is ailiaTFLiteGetNumberOfInputs() -1. If the specified Tensor does not contain an undecided dimension (if the Shape obtained in the ailiaTFLiteGetTensorShapeSignature does not include -1) will be an error.

◆ ailiaTFLiteSetCpuFeatures()

AILIATFLiteStatus ailiaTFLiteSetCpuFeatures ( struct AILIATFLiteInstance *  instance,
int32_t  cpu_features 
)

Set the CPU instruction to use.

Parameters
instanceailia TFLite runtime instance pointer
cpu_featuresAILIA_TFLITE_CPU_FEATURES_XXX logical sum
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If you fail, return AILIA_TFLITE_STATUS_XXX.

Set the CPU instruction to use. If an unusable CPU instruction is set, return AILIA_TFLITE_STATUS_OUT_OF_RANGE.

◆ ailiaTFLiteSetProfileMode()

AILIATFLiteStatus ailiaTFLiteSetProfileMode ( struct AILIATFLiteInstance *  instance,
int  mode 
)

Set the profile mode.

Parameters
instanceailia TFLite runtime instance pointer
modeProfile mode (AILIA_TFLITE_PROFILE_MODE_*)
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. In the case of other errors, return AILIA_TFLITE_STATUS_XXX.

Specify the profile mode.The default is invalid. When the profile mode is enabled, the profile result is added to the output of ailiaTFLiteGetSummary. It must be executed immediately after ailiaTFLiteCreate. If you call after ailiaTFLiteAllocateTensors, AILIA_TFLITE_STATUS_INVALID_STATE will be returned.

◆ ailiaTFLiteSetScratchBuffer()

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.

Parameters
instanceailia TFLite runtime instance pointer
int_bufferPointer to scratch buffer (L2)
int_buffer_sizeSize of scratch buffer (L2) (64 byte or above)
mid_bufferPointer to scratch buffer (MSMC)
mid_buffer_sizeSize of scratch buffer (MSMC)
ext_bufferPointer to scratch buffer (DDR)
ext_buffer_sizeSize of scratch buffer (DDR)

Set the scratch buffer used for mmalib.It is valid only when env_mmalib is specified. The alignment of the buffer is performed internally, so there is no need to consider alignment. If you specify 0 for a buffer size other than L2, you can disable the specified buffer. If you specify * env_mmalib, execute ailiaTFLiteAllocateTensors without calling this function, return AILIA_TFLITE_STATUS_INVALID_STATE. The scratch buffer can be changed each time ailiaTFLitePredict is called. However, the size of the scratch buffer must be the same as the value used in ailiaTFLiteAllocateTensors. Because it is used as a work area of non -permanent data, it is possible to give the same buffer to multiple instances for single threads.

◆ ailiaTFLiteSetSynchronizeFunctions()

AILIATFLiteStatus ailiaTFLiteSetSynchronizeFunctions ( struct AILIATFLiteInstance *  instance,
int(*)(void *)  pmain_after_command_store,
int(*)(void *)  pmain_before_state_load 
)

◆ alilaTFLiteSetSubCoreControlVariables()

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.

Parameters
instanceailia TFLite runtime instance pointer
control_variablesA pointer to the AILIATFLiteSubCoreControlVariables structure
sub_core_countNumber of sub-cores
Returns
If you succeed, return AILIA_TFLITE_STATUS_SUCCESS. If you fail, return AILIA_TFLITE_STATUS_XXX.

Specify number of sub-cores to sub_core_count, and specify a structure array with sub_core_count elements to control_variables.