ailia  1.3.0.0
Classes | Macros | Typedefs | Functions
ailia.h File Reference

inference library More...

#include "ailia_call.h"
Include dependency graph for ailia.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _AILIAShape
 
struct  _AILIAEnvironment
 

Macros

#define AILIA_API   __stdcall
 
#define AILIA_STATUS_SUCCESS   (0)
 Successful. More...
 
#define AILIA_STATUS_INVALID_ARGUMENT   (-1)
 Incorrect argument. More...
 
#define AILIA_STATUS_ERROR_FILE_API   (-2)
 File access failed. More...
 
#define AILIA_STATUS_INVALID_VERSION   (-3)
 Incorrect struct version. More...
 
#define AILIA_STATUS_BROKEN   (-4)
 A corrupt file was passed. More...
 
#define AILIA_STATUS_MEMORY_INSUFFICIENT   (-5)
 Insufficient memory. More...
 
#define AILIA_STATUS_THREAD_ERROR   (-6)
 Thread creation failed. More...
 
#define AILIA_STATUS_INVALID_STATE   (-7)
 The internal status of the ailia is incorrect. More...
 
#define AILIA_STATUS_UNSUPPORT_NET   (-9)
 Unsupported network. More...
 
#define AILIA_STATUS_INVALID_LAYER   (-10)
 Incorrect layer weight, parameter, or input or output shape. More...
 
#define AILIA_STATUS_INVALID_PARAMINFO   (-11)
 The content of the parameter file is invalid. More...
 
#define AILIA_STATUS_NOT_FOUND   (-12)
 The specified element was not found. More...
 
#define AILIA_STATUS_GPU_UNSUPPORT_LAYER   (-13)
 A layer parameter not supported by the GPU was given. More...
 
#define AILIA_STATUS_GPU_ERROR   (-14)
 Error during processing on the GPU. More...
 
#define AILIA_STATUS_UNIMPLEMENTED   (-15)
 Unimplemented error. More...
 
#define AILIA_STATUS_PERMISSION_DENIED   (-16)
 Operation not allowed. More...
 
#define AILIA_STATUS_EXPIRED   (-17)
 Model Expired. More...
 
#define AILIA_STATUS_UNSETTLED_SHAPE   (-18)
 The shape is not yet determined. More...
 
#define AILIA_STATUS_DATA_HIDDEN   (-19)
 The information was not available from the application. More...
 
#define AILIA_STATUS_DATA_REMOVED   AILIA_STATUS_DATA_HIDDEN
 
#define AILIA_STATUS_LICENSE_NOT_FOUND   (-20)
 No valid license found. More...
 
#define AILIA_STATUS_LICENSE_BROKEN   (-21)
 License is broken. More...
 
#define AILIA_STATUS_LICENSE_EXPIRED   (-22)
 License expired. More...
 
#define AILIA_STATUS_NDIMENSION_SHAPE   (-23)
 Dimension of shape is 5 or more. More...
 
#define AILIA_STATUS_OTHER_ERROR   (-128)
 Unknown error. More...
 
#define AILIA_SHAPE_VERSION   (1)
 
#define AILIA_MULTITHREAD_AUTO   (0)
 
#define AILIA_ENVIRONMENT_ID_AUTO   (-1)
 
#define AILIA_DATATYPE_UNDEFINED   0
 
#define AILIA_DATATYPE_FLOAT   1
 
#define AILIA_DATATYPE_UINT8   2
 
#define AILIA_DATATYPE_INT8   3
 
#define AILIA_DATATYPE_UINT16   4
 
#define AILIA_DATATYPE_INT16   5
 
#define AILIA_DATATYPE_INT32   6
 
#define AILIA_DATATYPE_INT64   7
 
#define AILIA_DATATYPE_BOOL   9
 
#define AILIA_DATATYPE_FLOAT16   10
 
#define AILIA_DATATYPE_DOUBLE   11
 
#define AILIA_DATATYPE_UINT32   12
 
#define AILIA_DATATYPE_UINT64   13
 
#define AILIA_DATATYPE_BFLOAT16   16
 
#define AILIA_ENVIRONMENT_VERSION   (2)
 
#define AILIA_ENVIRONMENT_TYPE_CPU   (0)
 
#define AILIA_ENVIRONMENT_TYPE_BLAS   (1)
 
#define AILIA_ENVIRONMENT_TYPE_GPU   (2)
 
#define AILIA_ENVIRONMENT_TYPE_REMOTE   (3)
 
#define AILIA_ENVIRONMENT_BACKEND_NONE   (0)
 
#define AILIA_ENVIRONMENT_BACKEND_CUDA   (2)
 
#define AILIA_ENVIRONMENT_BACKEND_MPS   (3)
 
#define AILIA_ENVIRONMENT_BACKEND_VULKAN   (6)
 
#define AILIA_ENVIRONMENT_PROPERTY_NORMAL   (0)
 
#define AILIA_ENVIRONMENT_PROPERTY_LOWPOWER   (1)
 
#define AILIA_ENVIRONMENT_PROPERTY_FP16   (2)
 
#define AILIA_MEMORY_NO_OPTIMIZATION   (0)
 
#define AILIA_MEMORY_REDUCE_CONSTANT   (1)
 
#define AILIA_MEMORY_REDUCE_CONSTANT_WITH_INPUT_INITIALIZER   (2)
 
#define AILIA_MEMORY_REDUCE_INTERSTAGE   (4)
 
#define AILIA_MEMORY_REUSE_INTERSTAGE   (8)
 
#define AILIA_MEMORY_REDUCE_CONSTANT_WITH_FILE_MAPPED   (16)
 
#define AILIA_MEMORY_OPTIMAIZE_DEFAULT   (AILIA_MEMORY_REDUCE_CONSTANT)
 
#define AILIA_PROFILE_DISABLE   (0x00)
 
#define AILIA_PROFILE_AVERAGE   (0x01)
 
#define ailiaOpenStreamFile   ailiaOpenStreamFileA
 
#define ailiaOpenWeightFile   ailiaOpenWeightFileA
 
#define ailiaSetTemporaryCachePath   ailiaSetTemporaryCachePathA
 

Typedefs

typedef struct _AILIAShape AILIAShape
 
typedef struct _AILIAEnvironment AILIAEnvironment
 

Functions

int AILIA_API ailiaCreate (struct AILIANetwork **net, int env_id, int num_thread)
 Creates a network instance. More...
 
int AILIA_API ailiaOpenStreamFileA (struct AILIANetwork *net, const char *path)
 Initializes the network instance. (Read from file) More...
 
int AILIA_API ailiaOpenStreamFileW (struct AILIANetwork *net, const wchar_t *path)
 
int AILIA_API ailiaOpenStreamEx (struct AILIANetwork *net, const void *fopen_args, ailiaFileCallback callback, int version)
 Initializes the network instance. (User-defined file access callback) More...
 
int AILIA_API ailiaOpenStreamMem (struct AILIANetwork *net, const void *buf, unsigned int buf_size)
 Initializes the network instance. (Read from memory) More...
 
int AILIA_API ailiaOpenWeightFileA (struct AILIANetwork *net, const char *path)
 Reads weights into a network instance. (Read from file) More...
 
int AILIA_API ailiaOpenWeightFileW (struct AILIANetwork *net, const wchar_t *path)
 
int AILIA_API ailiaOpenWeightEx (struct AILIANetwork *net, const void *fopen_args, ailiaFileCallback callback, int version)
 Reads weights into a network instance. (User-defined file access callback) More...
 
int AILIA_API ailiaOpenWeightMem (struct AILIANetwork *net, const void *buf, unsigned int buf_size)
 Reads weights into a network instance. (Read from memory) More...
 
void AILIA_API ailiaDestroy (struct AILIANetwork *net)
 It destroys the network instance. More...
 
int AILIA_API ailiaSetInputShape (struct AILIANetwork *net, const AILIAShape *shape, unsigned int version)
 Changes the shape of the input data during inference. More...
 
int AILIA_API ailiaSetInputShapeND (struct AILIANetwork *net, const unsigned int *shape, unsigned int dim)
 Changes the shape of the input data during inference. More...
 
int AILIA_API ailiaGetInputShape (struct AILIANetwork *net, AILIAShape *shape, unsigned int version)
 Gets the shape of the input data during inference. More...
 
int AILIA_API ailiaGetInputDim (struct AILIANetwork *net, unsigned int *dim)
 Gets the dimension of the input data during inference. More...
 
int AILIA_API ailiaGetInputShapeND (struct AILIANetwork *net, unsigned int *shape, unsigned int dim)
 Gets the shape of the input data during inference. More...
 
int AILIA_API ailiaGetOutputShape (struct AILIANetwork *net, AILIAShape *shape, unsigned int version)
 Gets the shape of the output data during inference. More...
 
int AILIA_API ailiaGetOutputDim (struct AILIANetwork *net, unsigned int *dim)
 Gets the dimension of the output data during inference. More...
 
int AILIA_API ailiaGetOutputShapeND (struct AILIANetwork *net, unsigned int *shape, unsigned int dim)
 Gets the shape of the output data during inference. More...
 
int AILIA_API ailiaPredict (struct AILIANetwork *net, void *dest, unsigned int dest_size, const void *src, unsigned int src_size)
 Performs the inferences and provides the inference result. More...
 
int AILIA_API ailiaGetBlobCount (struct AILIANetwork *net, unsigned int *blob_count)
 Gets the amount of internal data (blob) during inference. More...
 
int AILIA_API ailiaGetBlobShape (struct AILIANetwork *net, AILIAShape *shape, unsigned int blob_idx, unsigned int version)
 Gets the shape of the internal data (blob) during inference. More...
 
int AILIA_API ailiaGetBlobDim (struct AILIANetwork *net, unsigned int *dim, unsigned int blob_idx)
 Gets the dimension of the internal data (blob) during inference. More...
 
int AILIA_API ailiaGetBlobShapeND (struct AILIANetwork *net, unsigned int *shape, unsigned int dim, unsigned int blob_idx)
 Gets the amount of internal data (blob) during inference. More...
 
int AILIA_API ailiaGetBlobData (struct AILIANetwork *net, void *dest, unsigned int dest_size, unsigned int blob_idx)
 Gets the internal data (blob) during inference. More...
 
int AILIA_API ailiaGetBlobDataType (struct AILIANetwork *net, int *type, unsigned int blob_idx)
 Get the type of Blob. More...
 
int AILIA_API ailiaFindBlobIndexByName (struct AILIANetwork *net, unsigned int *blob_idx, const char *name)
 Searches by name for the index of the internal data (blob) during inference and returns it. More...
 
int AILIA_API ailiaGetBlobNameLengthByIndex (struct AILIANetwork *net, const unsigned int blob_idx, unsigned int *buffer_size)
 Gets the size of the buffer needed for output of the name of the internal data (blob). More...
 
int AILIA_API ailiaFindBlobNameByIndex (struct AILIANetwork *net, char *buffer, const unsigned int buffer_size, const unsigned int blob_idx)
 Searches by index for the name of the internal data (blob) during inference and returns it. More...
 
int AILIA_API ailiaGetSummaryLength (struct AILIANetwork *net, unsigned int *buffer_size)
 Gets the size of the buffer needed for the network summary. More...
 
int AILIA_API ailiaSummary (struct AILIANetwork *net, char *const buffer, const unsigned int buffer_size)
 Shows the name and shape of each blob. More...
 
int AILIA_API ailiaGetInputBlobCount (struct AILIANetwork *net, unsigned int *input_blob_count)
 Get the number of input data blobs. More...
 
int AILIA_API ailiaGetBlobIndexByInputIndex (struct AILIANetwork *net, unsigned int *blob_idx, unsigned int input_blob_idx)
 Get the blob index of the input data. More...
 
int AILIA_API ailiaSetInputBlobData (struct AILIANetwork *net, const void *src, unsigned int src_size, unsigned int blob_idx)
 Provides the specified blob with the input data. More...
 
int AILIA_API ailiaSetInputBlobShape (struct AILIANetwork *net, const AILIAShape *shape, unsigned int blob_idx, unsigned int version)
 Change the shape of the blob given by its index. More...
 
int AILIA_API ailiaSetInputBlobShapeND (struct AILIANetwork *net, const unsigned *shape, const unsigned dim, unsigned int blob_idx)
 Change the shape of the blob given by its index. More...
 
int AILIA_API ailiaCopyBlobData (struct AILIANetwork *dst_net, unsigned int dst_blob_idx, struct AILIANetwork *src_net, unsigned int src_blob_idx)
 Perform copies between blobs that specified. More...
 
int AILIA_API ailiaUpdate (struct AILIANetwork *net)
 Makes inferences with the input data specified in advance. More...
 
int AILIA_API ailiaGetOutputBlobCount (struct AILIANetwork *net, unsigned int *output_blob_count)
 Get the number of output data blobs. More...
 
int AILIA_API ailiaGetBlobIndexByOutputIndex (struct AILIANetwork *net, unsigned int *blob_idx, unsigned int output_blob_idx)
 Get the blob index of the input data blob. More...
 
int AILIA_API ailiaFinalize (void)
 Release GPU and other resources that have been globally allocated with ailia. More...
 
int AILIA_API ailiaSetTemporaryCachePathA (const char *cache_dir)
 Specifies a temporary cache directory. More...
 
int AILIA_API ailiaSetTemporaryCachePathW (const wchar_t *cache_dir)
 
int AILIA_API ailiaGetEnvironmentCount (unsigned int *env_count)
 Gets the number of available computational environments (CPU, GPU). More...
 
int AILIA_API ailiaGetEnvironment (AILIAEnvironment **env, unsigned int env_idx, unsigned int version)
 Gets the list of computational environments. More...
 
int AILIA_API ailiaGetSelectedEnvironment (struct AILIANetwork *net, AILIAEnvironment **env, unsigned int version)
 Gets the selected computational environment. More...
 
int AILIA_API ailiaSetMemoryMode (struct AILIANetwork *net, unsigned int mode)
 Set the memory usage policy for inference. More...
 
int AILIA_API ailiaDisableLayerFusion (struct AILIANetwork *net)
 Disalbe layer fusion optimaization for inference. More...
 
int AILIA_API ailiaSetProfileMode (struct AILIANetwork *net, unsigned int mode)
 Set the profile mode. More...
 
const char *AILIA_API ailiaGetStatusString (int status_code)
 Returns the string describing given status code. More...
 
const char *AILIA_API ailiaGetErrorDetail (struct AILIANetwork *net)
 Returns the details of errors. More...
 
const char *AILIA_API ailiaGetVersion (void)
 Get the version of the library. More...
 

Detailed Description

inference library

Date
May 26, 2023

Macro Definition Documentation

◆ AILIA_API

#define AILIA_API   __stdcall

◆ AILIA_DATATYPE_BFLOAT16

#define AILIA_DATATYPE_BFLOAT16   16

◆ AILIA_DATATYPE_BOOL

#define AILIA_DATATYPE_BOOL   9

◆ AILIA_DATATYPE_DOUBLE

#define AILIA_DATATYPE_DOUBLE   11

◆ AILIA_DATATYPE_FLOAT

#define AILIA_DATATYPE_FLOAT   1

◆ AILIA_DATATYPE_FLOAT16

#define AILIA_DATATYPE_FLOAT16   10

◆ AILIA_DATATYPE_INT16

#define AILIA_DATATYPE_INT16   5

◆ AILIA_DATATYPE_INT32

#define AILIA_DATATYPE_INT32   6

◆ AILIA_DATATYPE_INT64

#define AILIA_DATATYPE_INT64   7

◆ AILIA_DATATYPE_INT8

#define AILIA_DATATYPE_INT8   3

◆ AILIA_DATATYPE_UINT16

#define AILIA_DATATYPE_UINT16   4

◆ AILIA_DATATYPE_UINT32

#define AILIA_DATATYPE_UINT32   12

◆ AILIA_DATATYPE_UINT64

#define AILIA_DATATYPE_UINT64   13

◆ AILIA_DATATYPE_UINT8

#define AILIA_DATATYPE_UINT8   2

◆ AILIA_DATATYPE_UNDEFINED

#define AILIA_DATATYPE_UNDEFINED   0

◆ AILIA_ENVIRONMENT_BACKEND_CUDA

#define AILIA_ENVIRONMENT_BACKEND_CUDA   (2)

◆ AILIA_ENVIRONMENT_BACKEND_MPS

#define AILIA_ENVIRONMENT_BACKEND_MPS   (3)

◆ AILIA_ENVIRONMENT_BACKEND_NONE

#define AILIA_ENVIRONMENT_BACKEND_NONE   (0)

◆ AILIA_ENVIRONMENT_BACKEND_VULKAN

#define AILIA_ENVIRONMENT_BACKEND_VULKAN   (6)

◆ AILIA_ENVIRONMENT_ID_AUTO

#define AILIA_ENVIRONMENT_ID_AUTO   (-1)

◆ AILIA_ENVIRONMENT_PROPERTY_FP16

#define AILIA_ENVIRONMENT_PROPERTY_FP16   (2)

Indicates that a FP16 mode

◆ AILIA_ENVIRONMENT_PROPERTY_LOWPOWER

#define AILIA_ENVIRONMENT_PROPERTY_LOWPOWER   (1)

Indicates that a low-power GPU (e.g. integrated GPU) will be preferentially used. (for MPS)

◆ AILIA_ENVIRONMENT_PROPERTY_NORMAL

#define AILIA_ENVIRONMENT_PROPERTY_NORMAL   (0)

◆ AILIA_ENVIRONMENT_TYPE_BLAS

#define AILIA_ENVIRONMENT_TYPE_BLAS   (1)

◆ AILIA_ENVIRONMENT_TYPE_CPU

#define AILIA_ENVIRONMENT_TYPE_CPU   (0)

◆ AILIA_ENVIRONMENT_TYPE_GPU

#define AILIA_ENVIRONMENT_TYPE_GPU   (2)

◆ AILIA_ENVIRONMENT_TYPE_REMOTE

#define AILIA_ENVIRONMENT_TYPE_REMOTE   (3)

◆ AILIA_ENVIRONMENT_VERSION

#define AILIA_ENVIRONMENT_VERSION   (2)

◆ AILIA_MEMORY_NO_OPTIMIZATION

#define AILIA_MEMORY_NO_OPTIMIZATION   (0)

Do not release the intermediate buffer

◆ AILIA_MEMORY_OPTIMAIZE_DEFAULT

#define AILIA_MEMORY_OPTIMAIZE_DEFAULT   (AILIA_MEMORY_REDUCE_CONSTANT)

◆ AILIA_MEMORY_REDUCE_CONSTANT

#define AILIA_MEMORY_REDUCE_CONSTANT   (1)

Releases the intermediate buffer that is a constant such as weight

◆ AILIA_MEMORY_REDUCE_CONSTANT_WITH_FILE_MAPPED

#define AILIA_MEMORY_REDUCE_CONSTANT_WITH_FILE_MAPPED   (16)

Infer with memory mapped file for weight due to reduce ram usage.

When need to convert weight, it will allocate temporary buffer and after infer, release buffer. It will apply when load from file, and environment that mmap available. It will create temporary file due to speedup mmap, so you should be call ailiaSetTemporaryCachePath. If do not call ailiaSetTemporaryCachePath and specify this, it will return error AILIA_STATUS_INVALID_STATE when call ailiaOpenWeightXXX. AILIA_MEMORY_REDUCE_INTERSTAGE and AILIA_MEMORY_REUSE_INTERSTAGE can be used together.

◆ AILIA_MEMORY_REDUCE_CONSTANT_WITH_INPUT_INITIALIZER

#define AILIA_MEMORY_REDUCE_CONSTANT_WITH_INPUT_INITIALIZER   (2)

Disable the input specified initializer and release the intermediate buffer that becomes a constant such as weight.

◆ AILIA_MEMORY_REDUCE_INTERSTAGE

#define AILIA_MEMORY_REDUCE_INTERSTAGE   (4)

Release intermediate buffer during inference

◆ AILIA_MEMORY_REUSE_INTERSTAGE

#define AILIA_MEMORY_REUSE_INTERSTAGE   (8)

Infer by sharing the intermediate buffer. When used with AILIA_MEMORY_REDUCE_INTERSTAGE , the sharable intermediate buffer is not opened.

◆ AILIA_MULTITHREAD_AUTO

#define AILIA_MULTITHREAD_AUTO   (0)

◆ AILIA_PROFILE_AVERAGE

#define AILIA_PROFILE_AVERAGE   (0x01)

Measure the processing time for each layer. If you infer multiple times, the average value excluding the first execution is saved.

◆ AILIA_PROFILE_DISABLE

#define AILIA_PROFILE_DISABLE   (0x00)

Disable profile mode (Default)

◆ AILIA_SHAPE_VERSION

#define AILIA_SHAPE_VERSION   (1)

◆ AILIA_STATUS_BROKEN

#define AILIA_STATUS_BROKEN   (-4)

A corrupt file was passed.

Remarks
Please check model file are correct or not, and please pass correct model.

◆ AILIA_STATUS_DATA_HIDDEN

#define AILIA_STATUS_DATA_HIDDEN   (-19)

The information was not available from the application.

Remarks
The specified information was removed due to optimization. If you need the information, please disable optimization and call API.

◆ AILIA_STATUS_DATA_REMOVED

#define AILIA_STATUS_DATA_REMOVED   AILIA_STATUS_DATA_HIDDEN

◆ AILIA_STATUS_ERROR_FILE_API

#define AILIA_STATUS_ERROR_FILE_API   (-2)

File access failed.

Remarks
Please check file is exist or not, and check access permission.

◆ AILIA_STATUS_EXPIRED

#define AILIA_STATUS_EXPIRED   (-17)

Model Expired.

Remarks
The model file are expired. Please re generate model with ailia_obfuscate_c.

◆ AILIA_STATUS_GPU_ERROR

#define AILIA_STATUS_GPU_ERROR   (-14)

Error during processing on the GPU.

Remarks
Please check the GPU driver are latest and VRAM are sufficient or not.

◆ AILIA_STATUS_GPU_UNSUPPORT_LAYER

#define AILIA_STATUS_GPU_UNSUPPORT_LAYER   (-13)

A layer parameter not supported by the GPU was given.

Remarks
The layer or parameter that not supported by the GPU was given. Please check model file are correct or not and contact support desk that described on document.

◆ AILIA_STATUS_INVALID_ARGUMENT

#define AILIA_STATUS_INVALID_ARGUMENT   (-1)

Incorrect argument.

Remarks
Please check argument of called API.

◆ AILIA_STATUS_INVALID_LAYER

#define AILIA_STATUS_INVALID_LAYER   (-10)

Incorrect layer weight, parameter, or input or output shape.

Remarks
The layer of model had incorrect parameter or so on. Please call ailiaGetErrorDetail() and check detail message. And, please check model.

◆ AILIA_STATUS_INVALID_PARAMINFO

#define AILIA_STATUS_INVALID_PARAMINFO   (-11)

The content of the parameter file is invalid.

Remarks
Please check parameter file are correct or not.

◆ AILIA_STATUS_INVALID_STATE

#define AILIA_STATUS_INVALID_STATE   (-7)

The internal status of the ailia is incorrect.

Remarks
Please check API document and API call steps.

◆ AILIA_STATUS_INVALID_VERSION

#define AILIA_STATUS_INVALID_VERSION   (-3)

Incorrect struct version.

Remarks
Please check struct version that passed with API and please pass correct struct version.

◆ AILIA_STATUS_LICENSE_BROKEN

#define AILIA_STATUS_LICENSE_BROKEN   (-21)

License is broken.

Remarks
The license file that are required for trial version are broken. Please contact support desk that described on document.

◆ AILIA_STATUS_LICENSE_EXPIRED

#define AILIA_STATUS_LICENSE_EXPIRED   (-22)

License expired.

Remarks
The license file that are required for trial version are expired. Please contact support desk that described on document.

◆ AILIA_STATUS_LICENSE_NOT_FOUND

#define AILIA_STATUS_LICENSE_NOT_FOUND   (-20)

No valid license found.

Remarks
The license file are required for trial version. Please contact support desk that described on document.

◆ AILIA_STATUS_MEMORY_INSUFFICIENT

#define AILIA_STATUS_MEMORY_INSUFFICIENT   (-5)

Insufficient memory.

Remarks
Please check usage of main memory and VRAM. And please call API after free memory.

◆ AILIA_STATUS_NDIMENSION_SHAPE

#define AILIA_STATUS_NDIMENSION_SHAPE   (-23)

Dimension of shape is 5 or more.

Remarks
The called API are supported up to 4 dimension. Please replace API that described on API document.

◆ AILIA_STATUS_NOT_FOUND

#define AILIA_STATUS_NOT_FOUND   (-12)

The specified element was not found.

Remarks
The specified element of passed name/index was not found. Please check the element are exisit on model or not.

◆ AILIA_STATUS_OTHER_ERROR

#define AILIA_STATUS_OTHER_ERROR   (-128)

Unknown error.

Remarks
The misc error has been occured. Please call ailiaGetErrorDetail() and check detail message. And, please contact support desk that described on document.

◆ AILIA_STATUS_PERMISSION_DENIED

#define AILIA_STATUS_PERMISSION_DENIED   (-16)

Operation not allowed.

Remarks
The called API are not allowed on this model (e.g. encrypted model are used.). Please check model file and change API call flow.

◆ AILIA_STATUS_SUCCESS

#define AILIA_STATUS_SUCCESS   (0)

Successful.

◆ AILIA_STATUS_THREAD_ERROR

#define AILIA_STATUS_THREAD_ERROR   (-6)

Thread creation failed.

Remarks
Please check usage of system resource (e.g. thread). And please call API after release system resources.

◆ AILIA_STATUS_UNIMPLEMENTED

#define AILIA_STATUS_UNIMPLEMENTED   (-15)

Unimplemented error.

Remarks
The called API are not available on current environment. Please contact support desk that described on document.

◆ AILIA_STATUS_UNSETTLED_SHAPE

#define AILIA_STATUS_UNSETTLED_SHAPE   (-18)

The shape is not yet determined.

Remarks
The shape (e.g. output shape) are not determined. When called API that to get output shape, please set input shape and execute inference, then call API that to get output shape.

◆ AILIA_STATUS_UNSUPPORT_NET

#define AILIA_STATUS_UNSUPPORT_NET   (-9)

Unsupported network.

Remarks
Non supported model file was passed to wrapper functions (e.g. Detector). Please check document whether presented models are supported or not.

◆ ailiaOpenStreamFile

#define ailiaOpenStreamFile   ailiaOpenStreamFileA

◆ ailiaOpenWeightFile

#define ailiaOpenWeightFile   ailiaOpenWeightFileA

◆ ailiaSetTemporaryCachePath

#define ailiaSetTemporaryCachePath   ailiaSetTemporaryCachePathA

Typedef Documentation

◆ AILIAEnvironment

◆ AILIAShape

typedef struct _AILIAShape AILIAShape

Function Documentation

◆ ailiaCopyBlobData()

int AILIA_API ailiaCopyBlobData ( struct AILIANetwork *  dst_net,
unsigned int  dst_blob_idx,
struct AILIANetwork *  src_net,
unsigned int  src_blob_idx 
)

Perform copies between blobs that specified.

Parameters
dst_netThe network object pointer that contains destination blob
dst_blob_idxThe index of destination blob
src_netThe network object pointer that contains source blob
src_blob_idxThe index of source blob
Returns
In case of success, AILIA_STATUS_SUCCESS , and otherwise the coresponding error code.

Perform copy blobs between specified network. It accepts copy over different network. The src_blob_index must be specify blob index that inputs of src_net, and the dst_blob_index mut be specify blob index that outputs of dst_net. If specify index of other blob for dst_blob_idx , this function returns AILIA_STATUS_INVALID_ARGUMENT . This API can be call after call ailiaOpenWeighXXX().

◆ ailiaCreate()

int AILIA_API ailiaCreate ( struct AILIANetwork **  net,
int  env_id,
int  num_thread 
)

Creates a network instance.

Parameters
netA pointer to the network instance pointer
env_idThe ID of the inference backend used for computation (obtained by ailiaGetEnvironment() ). It is selected automatically if AILIA_ENVIRONMENT_ID_AUTO is specified.
num_threadThe upper limit on the number of threads (It is set automatically if AILIA_MULTITHREAD_AUTO is specified.)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

Creates a network instance. If the inference backend is set to automatic, CPU mode is used, while if BLAS is available, it uses BLAS. Note that if BLAS is used, num_thread may be ignored.

◆ ailiaDestroy()

void AILIA_API ailiaDestroy ( struct AILIANetwork *  net)

It destroys the network instance.

Parameters
netA network instance pointer

◆ ailiaDisableLayerFusion()

int AILIA_API ailiaDisableLayerFusion ( struct AILIANetwork *  net)

Disalbe layer fusion optimaization for inference.

Parameters
netA network instance pointer
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This api use to get blob that remove by layer fusion optimization. Must be specified immediately after ailiaCreate() . It cannot be changed after calling ailiaOpen. Note: When disable layer fusion optimization, inference speed may be down.

◆ ailiaFinalize()

int AILIA_API ailiaFinalize ( void  )

Release GPU and other resources that have been globally allocated with ailia.

Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

It must be called with all ailia instances created by ailiaCreate() released by ailiaDestroy(). Otherwise, #ref AILIA_STATUS_INVALID_STATE will be returned. Call this API from DllMain() on Windows OS, there is possibility of a deadlock.

◆ ailiaFindBlobIndexByName()

int AILIA_API ailiaFindBlobIndexByName ( struct AILIANetwork *  net,
unsigned int *  blob_idx,
const char *  name 
)

Searches by name for the index of the internal data (blob) during inference and returns it.

Parameters
netA network instance pointer
blob_idxThe index of the blob (0 to ailiaGetBlobCount() -1)
nameThe name of the blob to search for
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenStreamXXX(). In addition, when call this API before call ailiaOpenWeightXXX, can only find inputs and outputs blobs. If you want find intermediate blobs, please call ailiaOpenWeightXXX before.

◆ ailiaFindBlobNameByIndex()

int AILIA_API ailiaFindBlobNameByIndex ( struct AILIANetwork *  net,
char *  buffer,
const unsigned int  buffer_size,
const unsigned int  blob_idx 
)

Searches by index for the name of the internal data (blob) during inference and returns it.

Parameters
netA network instance pointer
bufferThe output destination buffer for the blob name
buffer_sizeThe size of the buffer (including the null terminator)
blob_idxThe index of the blob to search for
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenStreamXXX(). In addition, when call this API before call ailiaOpenWeightXXX, can only find inputs and outputs blobs. If you want find intermediate blobs, please call ailiaOpenWeightXXX before.

◆ ailiaGetBlobCount()

int AILIA_API ailiaGetBlobCount ( struct AILIANetwork *  net,
unsigned int *  blob_count 
)

Gets the amount of internal data (blob) during inference.

Parameters
netA network instance pointer
blob_countStorage location of the number of blobs
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenStreamXXX(). In addition, this api returuns number of sum of inputs and outputs when after call ailiaOpenStreamXXX. And, when call ailiaOpenWeightXXX, enumerate and optimzie intermediate blobs. So, this api may return more count after call ailiaOpenWeightXXX.

◆ ailiaGetBlobData()

int AILIA_API ailiaGetBlobData ( struct AILIANetwork *  net,
void *  dest,
unsigned int  dest_size,
unsigned int  blob_idx 
)

Gets the internal data (blob) during inference.

Parameters
netA network instance pointer
destThe result is stored in the inference result destination buffer as numeric type data in the order of X, Y, Z, and W.
dest_sizeThe number of bytes for the inference result destination buffer
blob_idxThe index of the blob (0 to ailiaGetBlobCount() -1)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

If ailiaPredict() or ailiaUpdate() is not run at all, the function returns AILIA_STATUS_INVALID_STATE .

◆ ailiaGetBlobDataType()

int AILIA_API ailiaGetBlobDataType ( struct AILIANetwork *  net,
int *  type,
unsigned int  blob_idx 
)

Get the type of Blob.

Parameters
netA network instance pointer
blob_idxThe index of the blob (0 to ailiaGetBlobCount() -1)
typeThe type of blob is stored to it. Values are defined as AILIA_DATATYPE_XXX.
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenWeighXXX().

◆ ailiaGetBlobDim()

int AILIA_API ailiaGetBlobDim ( struct AILIANetwork *  net,
unsigned int *  dim,
unsigned int  blob_idx 
)

Gets the dimension of the internal data (blob) during inference.

Parameters
netA network instance pointer
dimThe storage location of the dimension
blob_idxThe index of the blob (0 to ailiaGetBlobCount() -1)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenWeighXXX().

◆ ailiaGetBlobIndexByInputIndex()

int AILIA_API ailiaGetBlobIndexByInputIndex ( struct AILIANetwork *  net,
unsigned int *  blob_idx,
unsigned int  input_blob_idx 
)

Get the blob index of the input data.

Parameters
netA network instance pointer
blob_idxindex of the blob (between 0 and ailiaGetBlobCount() -1)
input_blob_idxindex among the input blobs (between 0 and ailiaGetInputBlobCount() -1)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenStreamXXX(). In addition, we guarantee that input_blob_idx and blob_idx which enumerate when call ailiaOpenStreamXXX are not changed when call ailiaOpneWeightXXX.

◆ ailiaGetBlobIndexByOutputIndex()

int AILIA_API ailiaGetBlobIndexByOutputIndex ( struct AILIANetwork *  net,
unsigned int *  blob_idx,
unsigned int  output_blob_idx 
)

Get the blob index of the input data blob.

Parameters
netA network instance pointer
blob_idxblob index (between 0 and ailiaGetBlobCount() -1)
output_blob_idxindex among output blobs (between 0 and ailiaGetOutputBlobCount() -1)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenStreamXXX().

◆ ailiaGetBlobNameLengthByIndex()

int AILIA_API ailiaGetBlobNameLengthByIndex ( struct AILIANetwork *  net,
const unsigned int  blob_idx,
unsigned int *  buffer_size 
)

Gets the size of the buffer needed for output of the name of the internal data (blob).

Parameters
netA network instance pointer
blob_idxThe index of the blob (0 to ailiaGetBlobCount() -1)
buffer_sizeThe size of the buffer needed for output of the blob name (including the null terminator)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenStreamXXX(). In addition, when call this API before call ailiaOpenWeightXXX, can only find inputs and outputs blobs. If you want find intermediate blobs, please call ailiaOpenWeightXXX before.

◆ ailiaGetBlobShape()

int AILIA_API ailiaGetBlobShape ( struct AILIANetwork *  net,
AILIAShape shape,
unsigned int  blob_idx,
unsigned int  version 
)

Gets the shape of the internal data (blob) during inference.

Parameters
netA network instance pointer
shapeStorage location of the data shape information
blob_idxThe index of the blob (0 to ailiaGetBlobCount() -1)
versionAILIA_SHAPE_VERSION
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS . And if shape has 5 or more dimension, it returns AILIA_STATUS_NDIMENSION_SHAPE , or an error code otherwise.

When dimension of shape is 5 or more, please use ailiaGetBlobDim() and ailiaGetBlobShapeND(). This API can be call after call ailiaOpenWeighXXX().

◆ ailiaGetBlobShapeND()

int AILIA_API ailiaGetBlobShapeND ( struct AILIANetwork *  net,
unsigned int *  shape,
unsigned int  dim,
unsigned int  blob_idx 
)

Gets the amount of internal data (blob) during inference.

Parameters
netA network instance pointer
shapeThe storage location of the shape array. (It stores dim-1, dim-2, ... ,1, 0 order.)
dimThe size of shape
blob_idxThe index of the blob (0 to ailiaGetBlobCount() -1)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenWeighXXX().

◆ ailiaGetEnvironment()

int AILIA_API ailiaGetEnvironment ( AILIAEnvironment **  env,
unsigned int  env_idx,
unsigned int  version 
)

Gets the list of computational environments.

Parameters
envThe storage location of the computational environment information (valid until the AILIANetwork instance is destroyed)
env_idxThe index of the computational environment information (0 to ailiaGetEnvironmentCount() -1)
versionAILIA_ENVIRONMENT_VERSION
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

◆ ailiaGetEnvironmentCount()

int AILIA_API ailiaGetEnvironmentCount ( unsigned int *  env_count)

Gets the number of available computational environments (CPU, GPU).

Parameters
env_countThe storage location of the number of computational environment information
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

◆ ailiaGetErrorDetail()

const char* AILIA_API ailiaGetErrorDetail ( struct AILIANetwork *  net)

Returns the details of errors.

Parameters
netThe network instance pointer
Returns
Error details

The return value does not have to be released. The string is valid until the next ailia API function is called. If model is encrypted, this function returns empty string.

◆ ailiaGetInputBlobCount()

int AILIA_API ailiaGetInputBlobCount ( struct AILIANetwork *  net,
unsigned int *  input_blob_count 
)

Get the number of input data blobs.

Parameters
netA network instance pointer
input_blob_countStorage location of the number of input blobs
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenStreamXXX(). In addition, this api returuns number of inputs when after call ailiaOpenStreamXXX. And, when call ailiaOpenWeightXXX, enumerate and optimzie initializer with input blobs. So, this api may return more count after call ailiaOpenWeightXXX.

◆ ailiaGetInputDim()

int AILIA_API ailiaGetInputDim ( struct AILIANetwork *  net,
unsigned int *  dim 
)

Gets the dimension of the input data during inference.

Parameters
netA network instance pointer
dimThe storage location of the dimension
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenWeighXXX().

◆ ailiaGetInputShape()

int AILIA_API ailiaGetInputShape ( struct AILIANetwork *  net,
AILIAShape shape,
unsigned int  version 
)

Gets the shape of the input data during inference.

Parameters
netA network instance pointer
shapeShape information for the input data
versionAILIA_SHAPE_VERSION
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS . If shape has 5 or more dimension, it returns AILIA_STATUS_NDIMENSION_SHAPE . And if shape is not seattled, it returns AILIA_STATUS_UNSETTLED_SHAPE , or an error code otherwise.

When dimension of shape is 5 or more, please use ailiaGetInputDim() and ailiaGetInputShapeND(). When shape is not settled, this function stores 0 at unsettled dimension and otherwise stores valid value. This API can be call after call ailiaOpenWeighXXX().

◆ ailiaGetInputShapeND()

int AILIA_API ailiaGetInputShapeND ( struct AILIANetwork *  net,
unsigned int *  shape,
unsigned int  dim 
)

Gets the shape of the input data during inference.

Parameters
netA network instance pointer
shapeThe storage location of the shape array. (It stores dim-1, dim-2, ... ,1, 0 order.)
dimThe size of shape
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS . And if shape is not seattled, it returns AILIA_STATUS_UNSETTLED_SHAPE , or an error code otherwise.

When shape is not settled, this function stores 0 at unsettled dimension and otherwise stores valid value. This API can be call after call ailiaOpenWeighXXX().

◆ ailiaGetOutputBlobCount()

int AILIA_API ailiaGetOutputBlobCount ( struct AILIANetwork *  net,
unsigned int *  output_blob_count 
)

Get the number of output data blobs.

Parameters
netA network instance pointer
output_blob_countStorage location for the number of output blobs.
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenStreamXXX().

◆ ailiaGetOutputDim()

int AILIA_API ailiaGetOutputDim ( struct AILIANetwork *  net,
unsigned int *  dim 
)

Gets the dimension of the output data during inference.

Parameters
netA network instance pointer
dimThe storage location of the dimension
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenWeighXXX().

◆ ailiaGetOutputShape()

int AILIA_API ailiaGetOutputShape ( struct AILIANetwork *  net,
AILIAShape shape,
unsigned int  version 
)

Gets the shape of the output data during inference.

Parameters
netA network instance pointer
shapeShape information of the output data
versionAILIA_SHAPE_VERSION
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS . And if shape has 5 or more dimension, it returns AILIA_STATUS_NDIMENSION_SHAPE , or an error code otherwise.

When dimension of shape is 5 or more, please use ailiaGetOutputDim() () and ailiaGetOutputShapeND(). This API can be call after call ailiaOpenWeighXXX().

◆ ailiaGetOutputShapeND()

int AILIA_API ailiaGetOutputShapeND ( struct AILIANetwork *  net,
unsigned int *  shape,
unsigned int  dim 
)

Gets the shape of the output data during inference.

Parameters
netA network instance pointer
shapeThe storage location of the shape array. (It stores dim-1, dim-2, ... ,1, 0 order.)
dimThe size of shape
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenWeighXXX().

◆ ailiaGetSelectedEnvironment()

int AILIA_API ailiaGetSelectedEnvironment ( struct AILIANetwork *  net,
AILIAEnvironment **  env,
unsigned int  version 
)

Gets the selected computational environment.

Parameters
netA network instance pointer
envThe storage location of the computational environment information (valid until the AILIANetwork instance is destroyed)
versionAILIA_ENVIRONMENT_VERSION
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

◆ ailiaGetStatusString()

const char* AILIA_API ailiaGetStatusString ( int  status_code)

Returns the string describing given status code.

Parameters
status_codeStatus code
Returns
String describing given status code. Retuned string is valid until the library of ailia (ailia.dll, libailia.so, etc) is unloaded.

The return value does not have to be released. If an instance of AILIANetwork is exist, ailiaGetErrorDetail() can be used to get the detail of the error.

◆ ailiaGetSummaryLength()

int AILIA_API ailiaGetSummaryLength ( struct AILIANetwork *  net,
unsigned int *  buffer_size 
)

Gets the size of the buffer needed for the network summary.

Parameters
netA network instance pointer
buffer_sizeThe storage location of the buffer size (including the null terminator)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenWeighXXX().

◆ ailiaGetVersion()

const char* AILIA_API ailiaGetVersion ( void  )

Get the version of the library.

Returns
Version number

The return value does not have to be released.

◆ ailiaOpenStreamEx()

int AILIA_API ailiaOpenStreamEx ( struct AILIANetwork *  net,
const void *  fopen_args,
ailiaFileCallback  callback,
int  version 
)

Initializes the network instance. (User-defined file access callback)

Parameters
netA network instance pointer
fopen_argsAn argument pointer supplied by AILIA_USER_API_FOPEN
callbackA struct for the user-defined file access callback function
versionThe version of the struct for the file access callback function ( AILIA_FILE_CALLBACK_VERSION )
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This function reads the network instance from a file and initializes it.

◆ ailiaOpenStreamFileA()

int AILIA_API ailiaOpenStreamFileA ( struct AILIANetwork *  net,
const char *  path 
)

Initializes the network instance. (Read from file)

Parameters
netA network instance pointer
pathThe path name to the prototxt file (MBSC or UTF16)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This function reads the network instance from a file and initializes it.

◆ ailiaOpenStreamFileW()

int AILIA_API ailiaOpenStreamFileW ( struct AILIANetwork *  net,
const wchar_t *  path 
)

◆ ailiaOpenStreamMem()

int AILIA_API ailiaOpenStreamMem ( struct AILIANetwork *  net,
const void *  buf,
unsigned int  buf_size 
)

Initializes the network instance. (Read from memory)

Parameters
netA network instance pointer
bufA pointer to the data in the prototxt file
buf_sizeThe data size of the prototxt file
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This function reads the network instance from memory and initializes it.

◆ ailiaOpenWeightEx()

int AILIA_API ailiaOpenWeightEx ( struct AILIANetwork *  net,
const void *  fopen_args,
ailiaFileCallback  callback,
int  version 
)

Reads weights into a network instance. (User-defined file access callback)

Parameters
netA network instance pointer
fopen_argsAn argument pointer supplied by AILIA_USER_API_FOPEN
callbackA struct for the user-defined file access callback function
versionThe version of the struct for the file access callback function ( AILIA_FILE_CALLBACK_VERSION )
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This function reads weights into the network instance from a file.

◆ ailiaOpenWeightFileA()

int AILIA_API ailiaOpenWeightFileA ( struct AILIANetwork *  net,
const char *  path 
)

Reads weights into a network instance. (Read from file)

Parameters
netA network instance pointer
pathThe path name to the protobuf/onnx file (MBSC or UTF16)
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This function reads weights into the network instance from a file.

◆ ailiaOpenWeightFileW()

int AILIA_API ailiaOpenWeightFileW ( struct AILIANetwork *  net,
const wchar_t *  path 
)

◆ ailiaOpenWeightMem()

int AILIA_API ailiaOpenWeightMem ( struct AILIANetwork *  net,
const void *  buf,
unsigned int  buf_size 
)

Reads weights into a network instance. (Read from memory)

Parameters
netA network instance pointer
bufA pointer to the data in the protobuf/onnx file
buf_sizeThe data size of the protobuf/onnx file
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This function reads weights into the network instance from memory.

◆ ailiaPredict()

int AILIA_API ailiaPredict ( struct AILIANetwork *  net,
void *  dest,
unsigned int  dest_size,
const void *  src,
unsigned int  src_size 
)

Performs the inferences and provides the inference result.

Parameters
netA network instance pointer
destThe result is stored in the inference result destination buffer as numeric type data in the order of X, Y, Z, and W. The buffer has the same size as the network file outputSize.
dest_sizeThe number of bytes for the destination buffer for the inference result
srcThe input is stored as numeric type data in the order of the inference data X, Y, Z, and W. The input has the same size as the network file inputSize.
src_sizeThe number of bytes of the inference data
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenWeighXXX().

◆ ailiaSetInputBlobData()

int AILIA_API ailiaSetInputBlobData ( struct AILIANetwork *  net,
const void *  src,
unsigned int  src_size,
unsigned int  blob_idx 
)

Provides the specified blob with the input data.

Parameters
netA network instance pointer
srcThe inference data is stored as numeric type data in the order of X, Y, Z, and W.
src_sizeThe number of bytes of the inference data
blob_idxThe index of the blob for input
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This function is used to specify the input on networks with multiple inputs. If something other than a blob in the input layer is specified for blob_idx, the function returns AILIA_STATUS_INVALID_ARGUMENT . This API can be call after call ailiaOpenWeighXXX().

◆ ailiaSetInputBlobShape()

int AILIA_API ailiaSetInputBlobShape ( struct AILIANetwork *  net,
const AILIAShape shape,
unsigned int  blob_idx,
unsigned int  version 
)

Change the shape of the blob given by its index.

Parameters
netnetwork object pointer
shapenew shape of the blob
blob_idxindex referencing the blob to reshape
versionAILIA_SHAPE_VERSION
Returns
In case of success, AILIA_STATUS_SUCCESS , and otherwise the coresponding error code.

This is useful to change the network input shape in a context where there are several input blobs. If blob_idx does not correspond to an input layer, AILIA_STATUS_INVALID_ARGUMENT is returned. For other related remarks, see the documentation of ailiaSetInputShape(). If dimension of shape has 5 or more, please use ailiaSetInputBlobShapeND(). This API can be call after call ailiaOpenWeighXXX().

◆ ailiaSetInputBlobShapeND()

int AILIA_API ailiaSetInputBlobShapeND ( struct AILIANetwork *  net,
const unsigned *  shape,
const unsigned  dim,
unsigned int  blob_idx 
)

Change the shape of the blob given by its index.

Parameters
netnetwork object pointer
shapeAn array of shape that contains size of each axis (dim-1, dim-2, ... ,1, 0)
dimThe size of shape.
blob_idxindex referencing the blob to reshape
Returns
In case of success, AILIA_STATUS_SUCCESS , and otherwise the coresponding error code.

This is useful to change the network input shape in a context where there are several input blobs. If blob_idx does not correspond to an input layer, AILIA_STATUS_INVALID_ARGUMENT is returned. For other related remarks, see the documentation of ailiaSetInputShapeND(). This API can be call after call ailiaOpenWeighXXX().

◆ ailiaSetInputShape()

int AILIA_API ailiaSetInputShape ( struct AILIANetwork *  net,
const AILIAShape shape,
unsigned int  version 
)

Changes the shape of the input data during inference.

Parameters
netA network instance pointer
shapeShape information for the input data
versionAILIA_SHAPE_VERSION
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This function changes the input shape defined in prototxt. The shape must have the same rank as the one contained in prototxt. Note that an error may be returned if the weights are dependent on the input shapes, among other reasons. The dimension of shape that defined in prototxt is less than 4, the unused element must be set to 1. The dimension of shape that defined in prototxt has 5 or more, please use ailiaSetInputShapeND(). This API can be call after call ailiaOpenWeighXXX()

◆ ailiaSetInputShapeND()

int AILIA_API ailiaSetInputShapeND ( struct AILIANetwork *  net,
const unsigned int *  shape,
unsigned int  dim 
)

Changes the shape of the input data during inference.

Parameters
netA network instance pointer
shapeAn array of shape that contains size of each axis (dim-1, dim-2, ... ,1, 0)
dimThe size of shape.
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This function changes the input shape defined in prototxt. The shape must have the same rank as the one contained in prototxt. Note that an error may be returned if the weights are dependent on the input shapes, among other reasons. This API can be call after call ailiaOpenWeighXXX().

◆ ailiaSetMemoryMode()

int AILIA_API ailiaSetMemoryMode ( struct AILIANetwork *  net,
unsigned int  mode 
)

Set the memory usage policy for inference.

Parameters
netA network instance pointer
modeMemory mode (Multiple specifications possible with logical sum) AILIA_MEMORY_XXX (Default : AILIA_MEMORY_REDUCE_CONSTANT )
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

Change the memory usage policy. If a value other than AILIA_MEMORY_NO_OPTIMIZATION is specified, the intermediate buffer secured during inference will be released, so the memory usage during inference can be reduced. Must be specified immediately after ailiaCreate() . It cannot be changed after calling ailiaOpen. If you specify to release the intermediate buffer, calling ailiaGetBlobData() for the corresponding blob will return an AILIA_STATUS_DATA_HIDDEN error.

◆ ailiaSetProfileMode()

int AILIA_API ailiaSetProfileMode ( struct AILIANetwork *  net,
unsigned int  mode 
)

Set the profile mode.

Parameters
netThe network instance pointer
modeProfile mode AILIA_PROFILE_XXX (Default : AILIA_PROFILE_DISABLE )
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

Set the profile mode. The default is profile disabled. Call it after calling ailiaOpenStreamXXX. When profile mode is enabled, you can get profile result via ailiaSummary() .

◆ ailiaSetTemporaryCachePathA()

int AILIA_API ailiaSetTemporaryCachePathA ( const char *  cache_dir)

Specifies a temporary cache directory.

Parameters
cache_dirTemporary cache directory
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This system uses the specified cache directory to generate and store machine code optimized for each inference backend. Call only once at the start of execution of ailia. It ignores any second and subsequent calls, and automatically returns success. There is no particular problem if it is called from multiple threads, as it provides exclusive control internally. Some functions, such as Vulkan shader cache, cannot be used until this API function is called. Specify the file path obtained by Context.getCacheDir() for cache_dir.

◆ ailiaSetTemporaryCachePathW()

int AILIA_API ailiaSetTemporaryCachePathW ( const wchar_t *  cache_dir)

◆ ailiaSummary()

int AILIA_API ailiaSummary ( struct AILIANetwork *  net,
char *const  buffer,
const unsigned int  buffer_size 
)

Shows the name and shape of each blob.

Parameters
netA network instance pointer
bufferThe output destination of the summary
buffer_sizeThe size of the output buffer (including the null terminator). Set the value obtained by ailiaGetSummaryLength() .
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This API can be call after call ailiaOpenWeighXXX().

◆ ailiaUpdate()

int AILIA_API ailiaUpdate ( struct AILIANetwork *  net)

Makes inferences with the input data specified in advance.

Parameters
netA network instance pointer
Returns
If this function is successful, it returns AILIA_STATUS_SUCCESS , or an error code otherwise.

This function is used when, for example, the input is provided with ailiaSetInputBlobData() . Get the inference result with ailiaGetBlobData() . This API can be call after call ailiaOpenWeighXXX().