ailia_tflite
1.2.2.0
|
AILIA TFLITE RUNTIME INTERFACE. More...
#include <stdint.h>
#include <stddef.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... | |
AILIA TFLITE RUNTIME INTERFACE.
#define AILIA_TFLITE_CPU_FEATURES_AVX (0x00000008) |
AVX.
#define AILIA_TFLITE_CPU_FEATURES_AVX2 (0x00000010) |
AVX2.
#define AILIA_TFLITE_CPU_FEATURES_AVX512 (0x00000040) |
AVX512.
#define AILIA_TFLITE_CPU_FEATURES_I8MM (0x00000080) |
I8MM.
#define AILIA_TFLITE_CPU_FEATURES_NEON (0x00000001) |
NEON.
#define AILIA_TFLITE_CPU_FEATURES_NONE (0x00000000) |
CPU extension disabled.
#define AILIA_TFLITE_CPU_FEATURES_SSE2 (0x00000002) |
SSE2.
#define AILIA_TFLITE_CPU_FEATURES_SSE4_2 (0x00000004) |
SSE4.2.
#define AILIA_TFLITE_CPU_FEATURES_VNNI (0x00000020) |
VNNI.
#define AILIA_TFLITE_ENV_MMALIB (2) |
Implementation using mmalib.The PC uses mmalib emulator, and mmalib is used for the device.
#define AILIA_TFLITE_ENV_MMALIB_COMPATIBLE (3) |
MMALIB output compatible implementation.It operates at high speed to perform only the output match.
#define AILIA_TFLITE_ENV_NNAPI (1) |
Implementation using NNAPI.For Android.
#define AILIA_TFLITE_ENV_QNN (4) |
Implementation using QNN.
#define AILIA_TFLITE_ENV_REFERENCE (0) |
Reference CPU implementation.
#define AILIA_TFLITE_FLAG_INPUT_AND_OUTPUT_TENSORS_USE_SCRATCH (1) |
#define AILIA_TFLITE_FLAG_NONE (0) |
Normal mode.
#define AILIA_TFLITE_MEMORY_MODE_DEFAULT (0) |
Normal mode.
#define AILIA_TFLITE_MEMORY_MODE_REDUCE_INTERSTAGE (1) |
Low Memory mode.
#define AILIA_TFLITE_PROFILE_MODE_DISABLE (0) |
Profile disabled.
#define AILIA_TFLITE_PROFILE_MODE_ENABLE (1) |
Profile enabled.
#define AILIA_TFLITE_PROFILE_MODE_MEMORY (4) |
Memory profile enabled.
#define AILIA_TFLITE_PROFILE_MODE_TRACE (2) |
Trace enabled.
#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.
#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.
#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.
#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.
#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.
#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.
#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.
#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.
#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.
#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.
#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.
#define AILIA_TFLITE_STATUS_SUCCESS ( 0) |
成功
#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.
#define AILIA_TFLITE_SUB_CORE_COUNT_MAX (8) |
The maximum number of cores in multicore environments.
#define AILIA_TFLITE_TENSOR_TYPE_BOOL (6) |
BOOL.
#define AILIA_TFLITE_TENSOR_TYPE_COMPLEX64 (8) |
COMPLEX64.
#define AILIA_TFLITE_TENSOR_TYPE_FLOAT16 (1) |
FLOAT16.
#define AILIA_TFLITE_TENSOR_TYPE_FLOAT32 (0) |
FLOAT32.
#define AILIA_TFLITE_TENSOR_TYPE_INT16 (7) |
INT16.
#define AILIA_TFLITE_TENSOR_TYPE_INT32 (2) |
INT32.
#define AILIA_TFLITE_TENSOR_TYPE_INT64 (4) |
INT64.
#define AILIA_TFLITE_TENSOR_TYPE_INT8 (9) |
INT8.
#define AILIA_TFLITE_TENSOR_TYPE_STRING (5) |
STRING.
#define AILIA_TFLITE_TENSOR_TYPE_UINT8 (3) |
UINT8.
typedef int32_t AILIATFLiteCpuFeatures |
typedef int32_t AILIATFLiteEnvironment |
typedef int32_t AILIATFLiteFlags |
typedef int32_t AILIATFLiteMemoryMode |
typedef int32_t AILIATFLiteStatus |
typedef int8_t AILIATFLiteTensorType |
AILIATFLiteStatus ailiaTFLiteAllocateTensors | ( | struct AILIATFLiteInstance * | instance | ) |
Ensure the internal buffer of ailia TFLite runtime.
instance | ailia TFLite runtime instance pointer |
Update the internal shape and secure the buffer required for inference.
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.
instance | ailia TFLite runtime Pointter to instance pointer |
tflite | Pointter to TFLITE model |
tflite_length | TFLITE length (byte unit) |
pmalloc | MALLOC function pointer (use malloc in the case of null) |
pmemcpy | MEMCPY function pointer (use Memcpy for null) |
pfree | FREE function pointer (use free in the case of null) |
phandle | Handle passed to Memoria Locator (NULL when using standard allocator) |
env_id | Progress execution environment used for calculation (AILIA_TFLITE_ENV_NAPI_*) |
memory_mode | Memory mode (AILIA_TFLITE_MEMORY_MODE_*) |
flags | Flag (logical sum of AILIA_TFLITE_FLAG_*) |
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.
void ailiaTFLiteDestroy | ( | struct AILIATFLiteInstance * | instance | ) |
Discard the instance of ailia TFLite runtime.
instance | ailia TFLite runtime instance pointer |
AILIATFLiteStatus ailiaTFLiteGetCpuFeatures | ( | struct AILIATFLiteInstance * | instance, |
int32_t * | cpu_features | ||
) |
Get the CPU instruction to use.
instance | ailia TFLite runtime instance pointer |
cpu_features | AILIA_TFLITE_CPU_FEATURES_XXX logical sum |
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.
AILIATFLiteStatus ailiaTFLiteGetEnvironment | ( | AILIATFLiteEnvironment * | env | ) |
Get a list of calculation environments.
env | Arrangement of storage destination of calculation environmental information |
Give the size of the ailiaTFLiteGetEnvironmentCount() to input to the input.
AILIATFLiteStatus ailiaTFLiteGetEnvironmentCount | ( | size_t * | env_count | ) |
Get the number of available calculation environments.
env_count | Pointter to the number of calculation environment information |
AILIATFLiteStatus ailiaTFLiteGetErrorDetail | ( | struct AILIATFLiteInstance * | instance, |
char ** | buffer | ||
) |
Returns the error details.
instance | ailia TFLite runtime instance pointer |
buffer | Error detailed pointer to string |
The string does not need to be released. The validity period of the string is to call the AILIA API.
AILIATFLiteStatus ailiaTFLiteGetInputTensorIndex | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | tensor_index, | ||
const int32_t | input_index | ||
) |
Get Tensor's index from index in Tensor.
instance | ailia TFLite runtime instance pointer |
tensor_index | Pointer to the destination of Tensor's index |
input_index | INDEX of input Tensor (0 ~ Number of input Tensor-1) |
Convert from index in Tensor to index of Tensor. The upper limit of INDEX is ailiaTFLiteGetNumberOfInputs() -1.
AILIATFLiteStatus ailiaTFLiteGetNodeCount | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | count | ||
) |
Get the number of node.
instance | ailia TFLite runtime instance pointer |
count | Pointter to the number of node stored |
AILIATFLiteStatus ailiaTFLiteGetNodeInputCount | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | count, | ||
const int32_t | node_index | ||
) |
Node_index gets the number of node input.
instance | ailia TFLite runtime instance pointer |
count | Pointter to the storage destination of the number of input |
node_index | Node index |
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.
instance | ailia TFLite runtime instance pointer |
tensor_index | Pointer to the destination of Tensor's index |
node_index | Node index |
input_index | INDEX for input |
AILIATFLiteStatus ailiaTFLiteGetNodeOperator | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | op, | ||
const int32_t | node_index | ||
) |
Get node_index number Operator.
instance | ailia TFLite runtime instance pointer |
op | Pointter to the destination of Operator |
node_index | Node index |
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.
AILIATFLiteStatus ailiaTFLiteGetNodeOption | ( | const struct AILIATFLiteInstance * | instance, |
void * | value, | ||
const int32_t | node_index, | ||
const char * | key | ||
) |
Node_index gets the Node option.
instance | aILIA TFLITE RUNTIME instance pointer |
value | Pointter to the storage destination of the output |
node_index | Node index |
key | Optional name string pointer |
AILIATFLiteStatus ailiaTFLiteGetNodeOutputCount | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | count, | ||
const int32_t | node_index | ||
) |
Node_index gets the number of node output.
instance | ailia TFLite runtime instance pointer |
count | Pointter to the storage destination of the number of output |
node_index | Node index |
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.
instance | ailia TFLite runtime instance pointer |
tensor_index | Pointer to the destination of Tensor's index |
node_index | Node index |
output_index | Output index |
AILIATFLiteStatus ailiaTFLiteGetNumberOfInputs | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | num_of_input_tensor | ||
) |
Get the number of TENSOR in the TFLITE model.
instance | ailia TFLite runtime instance pointer |
num_of_input_tensor | Pointter to the number of model input TENSOR |
AILIATFLiteStatus ailiaTFLiteGetNumberOfOutputs | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | num_of_output_tensor | ||
) |
Get the number of TENSOR of the TFLITE model.
instance | ailia TFLite runtime instance pointer |
num_of_output_tensor | Pointter to the number of model output TENSOR |
AILIATFLiteStatus ailiaTFLiteGetOperatorName | ( | const char ** | name, |
const int32_t | op | ||
) |
Get the Operator name.
name | Pointter to the destination of the string pointer with the name of Operator |
op | Operator |
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.
AILIATFLiteStatus ailiaTFLiteGetOutputTensorIndex | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | tensor_index, | ||
const int32_t | output_index | ||
) |
Obtain Tensor's index from index of output Tensor.
instance | ailia TFLite runtime instance pointer |
tensor_index | Pointer to the destination of Tensor's index |
output_index | Output TENSOR index (0 ~ Number of output Tensor-1) |
Convert from Index in Tensor to Tensor Index. The upper limit of INDEX is ailiaTFLiteGetNumberOfOutputs () -1.
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.
instance | ailia TFLite runtime instance pointer |
int_buffer_size | Size of scratch buffer (L2) |
mid_buffer_size | Size of scratch buffer (MSMC) |
ext_buffer_size | Size 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.
AILIATFLiteStatus ailiaTFLiteGetSummary | ( | struct AILIATFLiteInstance * | instance, |
char * | buffer, | ||
size_t | buffer_size | ||
) |
Displays the name and shape of each node.
instance | ailia TFLite runtime instance pointer |
buffer | SUMMARY output string pointer |
buffer_size | The size of the output buffer (including the terminal NULL character).Set the value obtained by AILIATFLITITEGETSUMMARYLENGTH (). |
AILIATFLiteStatus ailiaTFLiteGetSummaryLength | ( | struct AILIATFLiteInstance * | instance, |
size_t * | buffer_size | ||
) |
Get the size of the buffer required for network Summary.
instance | ailia TFLite runtime instance pointer |
buffer_size | Pointter to the storage destination of the size of the buffer (including the terminal NULL character) |
AILIATFLiteStatus ailiaTFLiteGetTensorBuffer | ( | struct AILIATFLiteInstance * | instance, |
void ** | buffer, | ||
const int32_t | tensor_index | ||
) |
Obtain a storage buffer in Tensor's data.
instance | ailia TFLite runtime instance pointer |
buffer | Pointter to the destination of the pointer to the data storage buffer |
tensor_index | Tensor's index |
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.
AILIATFLiteStatus ailiaTFLiteGetTensorDimension | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | tensor_dim, | ||
const int32_t | tensor_index | ||
) |
Get the dimension of index number Tensor.
instance | ailia TFLite runtime instance pointer |
tensor_dim | Pointter to the specified Tensor's dimension |
tensor_index | Tensor's index |
AILIATFLiteStatus ailiaTFLiteGetTensorName | ( | const struct AILIATFLiteInstance * | instance, |
const char ** | name, | ||
const int32_t | tensor_index | ||
) |
Get the name of the index number Tensor.
instance | ailia TFLite runtime instance pointer |
name | Pointter to the destination of the character string pointer named Tensor |
tensor_index | Tensor's index |
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.
AILIATFLiteStatus ailiaTFLiteGetTensorQuantizationCount | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | count, | ||
const int32_t | tensor_index | ||
) |
Get the number of quantified parameters of index number Tensor.
instance | ailia TFLite runtime instance pointer |
count | Pointter to the number of quantified parameters |
tensor_index | Tensor's index |
Get the number of quantified parameters associated with the specified Tensor. If there is no quantization parameter in the specified Tensor, 0 is stored.
AILIATFLiteStatus ailiaTFLiteGetTensorQuantizationQuantizedDimension | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | axis, | ||
const int32_t | tensor_index | ||
) |
Get the axis of the integrated TENSOR quantization parameter.
instance | ailia TFLite runtime instance pointer |
axis | Pointter to the destination of the axis of the quantized parameter |
tensor_index | Tensor's index |
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.
instance | ailia TFLite runtime instance pointer |
scale | Pointter to the storage destination of the quantized parameter |
tensor_index | Tensor's index |
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.
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.
instance | ailia TFLite runtime instance pointer |
zero_point | Pointter to the destination of zero points of quantization parameters |
tensor_index | Tensor's index |
See ailiaTFLiteGetTensorQuantizationScale for description of quantification. For zero_point, secure a buffer that is more than the number of elements acquired in ailiaTFLiteGetTensorQuantizationCountで.
AILIATFLiteStatus ailiaTFLiteGetTensorShape | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | shape, | ||
const int32_t | tensor_index | ||
) |
Get the shape of the index number Tensor.
instance | ailia TFLite runtime instance pointer |
shape | Tensor shape storage destination |
tensor_index | Tensor's index |
Store the shape of the specified Tensor in Shape. Shape should secure a buffer that is more than the dimensions acquired by ailiaTFLiteGetTensorDimension.
AILIATFLiteStatus ailiaTFLiteGetTensorShapeSignature | ( | const struct AILIATFLiteInstance * | instance, |
int32_t * | shape, | ||
const int32_t | tensor_index | ||
) |
Get the undecided dimensional form of Tensor of index number.
instance | ailia TFLite runtime instance pointer |
shape | Tensor shape storage destination |
tensor_index | Tensor's index |
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.
AILIATFLiteStatus ailiaTFLiteGetTensorType | ( | const struct AILIATFLiteInstance * | instance, |
AILIATFLiteTensorType * | tensor_type, | ||
const int32_t | tensor_index | ||
) |
Get the Data type of TENSOR in Index.
instance | ailia TFLite runtime instance pointer |
tensor_type | Specified TENSOR data type storage destination |
tensor_index | Tensor's index |
const char* ailiaTFLiteGetVersion | ( | void | ) |
Get the version of the library.
The return value does not have to be released.
AILIATFLiteStatus ailiaTFLiteMklDisableFastMM | ( | void | ) |
Disable the mkl fastmm.
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.
AILIATFLiteStatus ailiaTFLiteMklSetNumThreads | ( | const int32_t | num_threads | ) |
Set the number of threads used by MKL.
num_threads | Number of threads (1 or more) |
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.
AILIATFLiteStatus ailiaTFLitePredict | ( | struct AILIATFLiteInstance * | instance | ) |
Do inference.
instance | ailia TFLite runtime instance pointer |
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.
instance | ailia TFLite runtime instance pointer |
input_index | 0 ~ Input Tensor number-1 |
shape | New shape |
dim | dimension |
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.
AILIATFLiteStatus ailiaTFLiteSetCpuFeatures | ( | struct AILIATFLiteInstance * | instance, |
int32_t | cpu_features | ||
) |
Set the CPU instruction to use.
instance | ailia TFLite runtime instance pointer |
cpu_features | AILIA_TFLITE_CPU_FEATURES_XXX logical sum |
Set the CPU instruction to use. If an unusable CPU instruction is set, return AILIA_TFLITE_STATUS_OUT_OF_RANGE.
AILIATFLiteStatus ailiaTFLiteSetProfileMode | ( | struct AILIATFLiteInstance * | instance, |
int | mode | ||
) |
Set the profile mode.
instance | ailia TFLite runtime instance pointer |
mode | Profile mode (AILIA_TFLITE_PROFILE_MODE_*) |
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.
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.
instance | ailia TFLite runtime instance pointer |
int_buffer | Pointer to scratch buffer (L2) |
int_buffer_size | Size of scratch buffer (L2) (64 byte or above) |
mid_buffer | Pointer to scratch buffer (MSMC) |
mid_buffer_size | Size of scratch buffer (MSMC) |
ext_buffer | Pointer to scratch buffer (DDR) |
ext_buffer_size | Size 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.
AILIATFLiteStatus ailiaTFLiteSetSynchronizeFunctions | ( | struct AILIATFLiteInstance * | instance, |
int(*)(void *) | pmain_after_command_store, | ||
int(*)(void *) | pmain_before_state_load | ||
) |
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.
instance | ailia TFLite runtime instance pointer |
control_variables | A pointer to the AILIATFLiteSubCoreControlVariables structure |
sub_core_count | Number of sub-cores |
Specify number of sub-cores to sub_core_count, and specify a structure array with sub_core_count elements to control_variables.