15 #ifndef INCLUDED_AILIA
16 #define INCLUDED_AILIA
22 #include <emscripten.h>
23 #define AILIA_API EMSCRIPTEN_KEEPALIVE
24 #elif defined(_WIN64) || defined(_M_X64) || defined(__amd64__) || defined(__x86_64__) || defined(__APPLE__) || \
25 defined(__ANDROID__) || defined(ANDROID) || defined(__linux__) || defined(NN_NINTENDO_SDK)
28 #define AILIA_API __stdcall
49 #define AILIA_STATUS_SUCCESS (0)
61 #define AILIA_STATUS_INVALID_ARGUMENT (-1)
73 #define AILIA_STATUS_ERROR_FILE_API (-2)
85 #define AILIA_STATUS_INVALID_VERSION (-3)
97 #define AILIA_STATUS_BROKEN (-4)
109 #define AILIA_STATUS_MEMORY_INSUFFICIENT (-5)
121 #define AILIA_STATUS_THREAD_ERROR (-6)
133 #define AILIA_STATUS_INVALID_STATE (-7)
147 #define AILIA_STATUS_UNSUPPORTED_NET (-9)
151 #define AILIA_STATUS_UNSUPPORT_NET (-9)
165 #define AILIA_STATUS_INVALID_LAYER (-10)
177 #define AILIA_STATUS_INVALID_PARAMINFO (-11)
190 #define AILIA_STATUS_NOT_FOUND (-12)
204 #define AILIA_STATUS_GPU_UNSUPPORTED_LAYER (-13)
208 #define AILIA_STATUS_GPU_UNSUPPORT_LAYER (-13)
220 #define AILIA_STATUS_GPU_ERROR (-14)
234 #define AILIA_STATUS_UNIMPLEMENTED (-15)
248 #define AILIA_STATUS_PERMISSION_DENIED (-16)
260 #define AILIA_STATUS_EXPIRED (-17)
274 #define AILIA_STATUS_UNSETTLED_SHAPE (-18)
287 #define AILIA_STATUS_DATA_HIDDEN (-19)
288 #define AILIA_STATUS_DATA_REMOVED AILIA_STATUS_DATA_HIDDEN
301 #define AILIA_STATUS_LICENSE_NOT_FOUND (-20)
315 #define AILIA_STATUS_LICENSE_BROKEN (-21)
330 #define AILIA_STATUS_LICENSE_EXPIRED (-22)
343 #define AILIA_STATUS_NDIMENSION_SHAPE (-23)
357 #define AILIA_STATUS_OTHER_ERROR (-128)
369 #define AILIA_SHAPE_VERSION (1)
418 #define AILIA_MULTITHREAD_AUTO (0)
424 #define AILIA_ENVIRONMENT_ID_AUTO (-1)
431 #define AILIA_DATATYPE_UNDEFINED 0
432 #define AILIA_DATATYPE_FLOAT 1
433 #define AILIA_DATATYPE_UINT8 2
434 #define AILIA_DATATYPE_INT8 3
435 #define AILIA_DATATYPE_UINT16 4
436 #define AILIA_DATATYPE_INT16 5
437 #define AILIA_DATATYPE_INT32 6
438 #define AILIA_DATATYPE_INT64 7
439 #define AILIA_DATATYPE_BOOL 9
440 #define AILIA_DATATYPE_FLOAT16 10
441 #define AILIA_DATATYPE_DOUBLE 11
442 #define AILIA_DATATYPE_UINT32 12
443 #define AILIA_DATATYPE_UINT64 13
444 #define AILIA_DATATYPE_BFLOAT16 16
869 ailiaPredict(
struct AILIANetwork* net,
void* dest,
unsigned int dest_size,
const void* src,
unsigned int src_size);
1333 int AILIA_API ailiaCopyBlobData(
struct AILIANetwork* dst_net,
unsigned int dst_blob_idx,
struct AILIANetwork* src_net,
unsigned int src_blob_idx);
1431 #define AILIA_ENVIRONMENT_VERSION (2)
1433 #define AILIA_ENVIRONMENT_TYPE_CPU (0)
1434 #define AILIA_ENVIRONMENT_TYPE_BLAS (1)
1435 #define AILIA_ENVIRONMENT_TYPE_GPU (2)
1436 #define AILIA_ENVIRONMENT_TYPE_REMOTE (3)
1438 #define AILIA_ENVIRONMENT_BACKEND_NONE (0)
1439 #define AILIA_ENVIRONMENT_BACKEND_CUDA (2)
1440 #define AILIA_ENVIRONMENT_BACKEND_MPS (3)
1441 #define AILIA_ENVIRONMENT_BACKEND_VULKAN (6)
1443 #define AILIA_ENVIRONMENT_PROPERTY_NORMAL (0)
1451 #define AILIA_ENVIRONMENT_PROPERTY_LOWPOWER (1)
1459 #define AILIA_ENVIRONMENT_PROPERTY_FP16 (2)
1596 #define AILIA_MEMORY_NO_OPTIMIZATION (0)
1604 #define AILIA_MEMORY_REDUCE_CONSTANT (1)
1612 #define AILIA_MEMORY_REDUCE_CONSTANT_WITH_INPUT_INITIALIZER (2)
1620 #define AILIA_MEMORY_REDUCE_INTERSTAGE (4)
1630 #define AILIA_MEMORY_REUSE_INTERSTAGE (8)
1652 #define AILIA_MEMORY_REDUCE_CONSTANT_WITH_FILE_MAPPED (16)
1654 #define AILIA_MEMORY_OPTIMAIZE_DEFAULT (AILIA_MEMORY_REDUCE_CONSTANT)
1725 #define AILIA_PROFILE_DISABLE (0x00)
1734 #define AILIA_PROFILE_AVERAGE (0x01)
1829 #define ailiaOpenStreamFile ailiaOpenStreamFileW
1830 #define ailiaOpenWeightFile ailiaOpenWeightFileW
1831 #define ailiaSetTemporaryCachePath ailiaSetTemporaryCachePathW
1833 #define ailiaOpenStreamFile ailiaOpenStreamFileA
1834 #define ailiaOpenWeightFile ailiaOpenWeightFileA
1835 #define ailiaSetTemporaryCachePath ailiaSetTemporaryCachePathA
int AILIA_API ailiaOpenWeightMem(struct AILIANetwork *net, const void *buf, unsigned int buf_size)
Reads weights into a network instance. (Read from memory)
#define AILIA_API
Definition: ailia.h:28
int AILIA_API ailiaOpenWeightFileW(struct AILIANetwork *net, const wchar_t *path)
int AILIA_API ailiaOpenWeightFileA(struct AILIANetwork *net, const char *path)
Reads weights into a network instance. (Read from file)
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)
int AILIA_API ailiaGetSummaryLength(struct AILIANetwork *net, unsigned int *buffer_size)
Gets the size of the buffer needed for the network summary.
int AILIA_API ailiaDisableLayerFusion(struct AILIANetwork *net)
Disalbe layer fusion optimaization for inference.
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).
const char *AILIA_API ailiaGetErrorDetail(struct AILIANetwork *net)
Returns the details of errors.
int AILIA_API ailiaGetBlobData(struct AILIANetwork *net, void *dest, unsigned int dest_size, unsigned int blob_idx)
Gets the internal data (blob) during inference.
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.
int AILIA_API ailiaSetTemporaryCachePathA(const char *cache_dir)
Specifies a temporary cache directory.
int AILIA_API ailiaOpenStreamFileA(struct AILIANetwork *net, const char *path)
Initializes the network instance. (Read from file)
int AILIA_API ailiaGetBlobDim(struct AILIANetwork *net, unsigned int *dim, unsigned int blob_idx)
Gets the dimension of the internal data (blob) during inference.
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.
int AILIA_API ailiaGetBlobDataType(struct AILIANetwork *net, int *type, unsigned int blob_idx)
Get the type of Blob.
struct _AILIAEnvironment AILIAEnvironment
const char *AILIA_API ailiaGetVersion(void)
Get the version of the library.
int AILIA_API ailiaGetEnvironmentCount(unsigned int *env_count)
Gets the number of available computational environments (CPU, GPU).
int AILIA_API ailiaGetOutputBlobCount(struct AILIANetwork *net, unsigned int *output_blob_count)
Get the number of output data blobs.
void AILIA_API ailiaDestroy(struct AILIANetwork *net)
It destroys the network instance.
int AILIA_API ailiaSetInputShape(struct AILIANetwork *net, const AILIAShape *shape, unsigned int version)
Changes the shape of the input data during inference.
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.
int AILIA_API ailiaOpenStreamFileW(struct AILIANetwork *net, const wchar_t *path)
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.
int AILIA_API ailiaFinalize(void)
Release GPU and other resources that have been globally allocated with ailia.
int AILIA_API ailiaSetTemporaryCachePathW(const wchar_t *cache_dir)
const char *AILIA_API ailiaGetStatusString(int status_code)
Returns the string describing given status code.
int AILIA_API ailiaGetOutputShape(struct AILIANetwork *net, AILIAShape *shape, unsigned int version)
Gets the shape of the output data during inference.
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.
int AILIA_API ailiaSetMemoryMode(struct AILIANetwork *net, unsigned int mode)
Set the memory usage policy for inference.
int AILIA_API ailiaGetEnvironment(AILIAEnvironment **env, unsigned int env_idx, unsigned int version)
Gets the list of computational environments.
int AILIA_API ailiaGetInputBlobCount(struct AILIANetwork *net, unsigned int *input_blob_count)
Get the number of input data blobs.
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.
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.
int AILIA_API ailiaGetOutputDim(struct AILIANetwork *net, unsigned int *dim)
Gets the dimension of the output data during inference.
struct _AILIAShape AILIAShape
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.
int AILIA_API ailiaGetInputShape(struct AILIANetwork *net, AILIAShape *shape, unsigned int version)
Gets the shape of the input data during inference.
int AILIA_API ailiaOpenStreamEx(struct AILIANetwork *net, const void *fopen_args, ailiaFileCallback callback, int version)
Initializes the network instance. (User-defined file access callback)
int AILIA_API ailiaUpdate(struct AILIANetwork *net)
Makes inferences with the input data specified in advance.
int AILIA_API ailiaCreate(struct AILIANetwork **net, int env_id, int num_thread)
Creates a network instance.
int AILIA_API ailiaGetInputDim(struct AILIANetwork *net, unsigned int *dim)
Gets the dimension of the input data during inference.
int AILIA_API ailiaGetOutputShapeND(struct AILIANetwork *net, unsigned int *shape, unsigned int dim)
Gets the shape of the output data during inference.
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.
int AILIA_API ailiaSummary(struct AILIANetwork *net, char *const buffer, const unsigned int buffer_size)
Shows the name and shape of each blob.
int AILIA_API ailiaOpenStreamMem(struct AILIANetwork *net, const void *buf, unsigned int buf_size)
Initializes the network instance. (Read from memory)
int AILIA_API ailiaSetProfileMode(struct AILIANetwork *net, unsigned int mode)
Set the profile mode.
int AILIA_API ailiaGetBlobIndexByInputIndex(struct AILIANetwork *net, unsigned int *blob_idx, unsigned int input_blob_idx)
Get the blob index of the input data.
int AILIA_API ailiaGetBlobCount(struct AILIANetwork *net, unsigned int *blob_count)
Gets the amount of internal data (blob) during inference.
int AILIA_API ailiaGetInputShapeND(struct AILIANetwork *net, unsigned int *shape, unsigned int dim)
Gets the shape of the input data during inference.
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.
int AILIA_API ailiaGetSelectedEnvironment(struct AILIANetwork *net, AILIAEnvironment **env, unsigned int version)
Gets the selected computational environment.
int AILIA_API ailiaSetInputShapeND(struct AILIANetwork *net, const unsigned int *shape, unsigned int dim)
Changes the shape of the input data during inference.
const char * name
Definition: ailia.h:1485
int backend
Definition: ailia.h:1493
int type
Definition: ailia.h:1477
int id
Definition: ailia.h:1469
int props
Definition: ailia.h:1501
unsigned int w
Definition: ailia.h:403
unsigned int z
Definition: ailia.h:395
unsigned int y
Definition: ailia.h:387
unsigned int x
Definition: ailia.h:379
unsigned int dim
Definition: ailia.h:411
Definition: ailia_call.h:206