ailia  1.3.0.0
Classes | Public Member Functions | Public Attributes | List of all members
Ailia Class Reference

Classes

class  AILIAEnvironment
 
struct  ailiaFileCallback
 
class  AILIAShape
 

Public Member Functions

delegate IntPtr ailiaCallbackOpen (IntPtr args)
 
delegate Int32 ailiaCallbackSeek (IntPtr fp, Int64 offset)
 
delegate Int64 ailiaCallbackTell (IntPtr fp)
 
delegate Int64 ailiaCallbackSize (IntPtr fp)
 
delegate Int32 ailiaCallbackRead (IntPtr dest, Int64 size, IntPtr fp)
 
delegate Int32 ailiaCallbackClose (IntPtr fp)
 
static int ailiaCreate (ref IntPtr net, int env_id, int num_thread)
 Create a network object. More...
 
static int ailiaOpenStreamFile (IntPtr net, string path)
 Initialize network object. (read from file) More...
 
static int ailiaOpenWeightFile (IntPtr net, string path)
 Load weight coefficients into network object. More...
 
static int ailiaOpenStreamEx (IntPtr net, IntPtr fopen_args, ailiaFileCallback callback, Int32 version)
 Initialize network object. (user-defined file access callback) More...
 
static int ailiaOpenWeightEx (IntPtr net, IntPtr fopen_args, ailiaFileCallback callback, Int32 version)
 Load weight coefficients into network object. (user-defined file access callback) More...
 
static int ailiaOpenStreamMem (IntPtr net, byte[] buf, UInt32 buf_size)
 Initialize network object. (read from memory) More...
 
static int ailiaOpenWeightMem (IntPtr net, byte[] buf, UInt32 buf_size)
 Load weight coefficients into network object. (read from memory) More...
 
static void ailiaDestroy (IntPtr net)
 destroy network object * More...
 
static int ailiaSetInputShape (IntPtr net, [In] AILIAShape shape, UInt32 version)
 Change the shape of input data during inference. More...
 
static int ailiaSetInputShapeND (IntPtr net, UInt32 [] shape, UInt32 dim)
 Change the shape of input data during inference. More...
 
static int ailiaGetInputShape (IntPtr net, [In, Out] AILIAShape shape, UInt32 version)
 Get the shape of the input data during inference. More...
 
static int ailiaGetInputDim (IntPtr net, ref UInt32 dim)
 Get the dimension of the input data during inference. More...
 
static int ailiaGetInputShapeND (IntPtr net, UInt32[] shape, UInt32 dim)
 Get the shape of the input data during inference. More...
 
static int ailiaGetOutputShape (IntPtr net, [In, Out] AILIAShape shape, UInt32 version)
 Get the shape of the output data during inference and training. More...
 
static int ailiaGetOutputDim (IntPtr net, ref UInt32 dim)
 Get the dimension of the output data during inference. More...
 
static int ailiaGetOutputShapeND (IntPtr net, UInt32 [] shape, UInt32 dim)
 Get the shape of the output data during inference. More...
 
static int ailiaPredict (IntPtr net, IntPtr dest, UInt32 dest_size, IntPtr src, UInt32 src_size)
 Infer and get the result of inference. More...
 
static int ailiaGetBlobCount (IntPtr net, ref UInt32 blob_count)
 Get the number of internal data (Blob) at inference. More...
 
static int ailiaGetBlobShape (IntPtr net, [In, Out] AILIAShape shape, UInt32 blob_idx, UInt32 version)
 Get the shape of the internal data (Blob) at the time of inference. More...
 
static int ailiaGetBlobDim (IntPtr net, ref UInt32 dim, UInt32 blob_idx)
 Get the dimension of the internal data (Blob) at the time of inference. More...
 
static int ailiaGetBlobShapeND (IntPtr net, UInt32[] shape, UInt32 dim, UInt32 blob_idx)
 Get the shape of the internal data (Blob) at the time of inference. More...
 
static int ailiaGetBlobData (IntPtr net, IntPtr dest, UInt32 dest_size, UInt32 blob_idx)
 Get internal data (Blob) at inference time. More...
 
static int ailiaFindBlobIndexByName (IntPtr net, ref UInt32 blob_idx, string name)
 Find and get the index of the internal data (Blob) at inference time by name. More...
 
static int ailiaGetBlobNameLengthByIndex (IntPtr net, UInt32 blob_idx, ref UInt32 buffer_size)
 Output the required buffer size for the name of the internal data (Blob). More...
 
static int ailiaFindBlobNameByIndex (IntPtr net, IntPtr buffer, UInt32 buffer_size, UInt32 blob_idx)
 
static int ailiaGetSummaryLength (IntPtr net, ref UInt32 buffer_size)
 Output the required buffer size for network Summary. More...
 
static int ailiaSummary (IntPtr net, byte[] buffer, UInt32 buffer_size)
 Display the name and shape of each Blob. More...
 
static int ailiaGetInputBlobCount (IntPtr net, ref UInt32 input_blob_count)
 Get the number of input data (Blob). More...
 
static int ailiaGetBlobIndexByInputIndex (IntPtr net, ref UInt32 blob_idx, UInt32 input_blob_idx)
 Get the index of the input data (Blob) More...
 
static int ailiaSetInputBlobData (IntPtr net, IntPtr src, UInt32 src_size, UInt32 blob_idx)
 Give input data to the specified Blob. More...
 
static int ailiaSetInputBlobShape (IntPtr net, [In] AILIAShape shape, UInt32 blob_idx, UInt32 version)
 Change the shape of the specified Blob. More...
 
static int ailiaSetInputBlobShapeND (IntPtr net, UInt32[] shape, UInt32 dim, UInt32 blob_idx)
 Change the shape of the specified Blob. More...
 
static int ailiaCopyBlobData (IntPtr dst_net, UInt32 dst_blob_idx, IntPtr src_net, UInt32 src_blob_idx)
 Perform copies between blobs that specified. More...
 
static int ailiaUpdate (IntPtr net)
 Perform inference with pre-specified input data. More...
 
static int ailiaGetOutputBlobCount (IntPtr net, ref UInt32 output_blob_count)
 Get the number of output data (Blob). More...
 
static int ailiaGetBlobIndexByOutputIndex (IntPtr net, ref UInt32 blob_idx, UInt32 output_blob_idx)
 get index of output data (Blob) More...
 
static int ailiaSetTemporaryCachePath (string path)
 Specify temporary cache directory. More...
 
static int ailiaGetEnvironmentCount (ref Int32 env_count)
 Get the number of available computing environments (CPU, GPU) More...
 
static int ailiaGetEnvironment (ref IntPtr env, UInt32 env_idx, UInt32 version)
 
static int ailiaGetSelectedEnvironment (IntPtr net, ref IntPtr env, UInt32 version)
 Get the selected computing environment. More...
 
static int ailiaSetMemoryMode (IntPtr net, UInt32 mode)
 Sets the memory usage policy during inference. More...
 
static int ailiaDisableLayerFusion (IntPtr net)
 Disables layer integration during inference. More...
 
static int ailiaSetProfileMode (IntPtr net, UInt32 mode)
 Set profile mode. More...
 
static IntPtr ailiaGetStatusString (Int32 status)
 Returns a string describing the status code. More...
 
static IntPtr ailiaGetErrorDetail (IntPtr net)
 Returns error details. More...
 
static IntPtr ailiaGetVersion ()
 Get the library version. More...
 
static int ailiaFinalize ()
 Release GPU and other resources that have been globally allocated with ailia. More...
 

Public Attributes

const Int32 AILIA_STATUS_SUCCESS =( 0)
 
const Int32 AILIA_STATUS_INVALID_ARGUMENT =( -1)
 
const Int32 AILIA_STATUS_ERROR_FILE_API =( -2)
 
const Int32 AILIA_STATUS_INVALID_VERSION =( -3)
 
const Int32 AILIA_STATUS_BROKEN =( -4)
 
const Int32 AILIA_STATUS_MEMORY_INSUFFICIENT =( -5)
 
const Int32 AILIA_STATUS_THREAD_ERROR =( -6)
 
const Int32 AILIA_STATUS_INVALID_STATE =( -7)
 
const Int32 AILIA_STATUS_UNSUPPORT_NET =( -9)
 
const Int32 AILIA_STATUS_INVALID_LAYER =( -10)
 
const Int32 AILIA_STATUS_INVALID_PARAMINFO =( -11)
 
const Int32 AILIA_STATUS_NOT_FOUND =( -12)
 
const Int32 AILIA_STATUS_GPU_UNSUPPORT_LAYER =( -13)
 
const Int32 AILIA_STATUS_GPU_ERROR =( -14)
 
const Int32 AILIA_STATUS_UNIMPLEMENTED =( -15)
 
const Int32 AILIA_STATUS_PERMISSION_DENIED =( -16)
 
const Int32 AILIA_STATUS_EXPIRED =( -17)
 
const Int32 AILIA_STATUS_UNSETTLED_SHAPE =( -18)
 
const Int32 AILIA_STATUS_DATA_HIDDEN =( -19)
 
const Int32 AILIA_STATUS_DATA_REMOVED =AILIA_STATUS_DATA_HIDDEN
 
const Int32 AILIA_STATUS_LICENSE_NOT_FOUND =( -20)
 
const Int32 AILIA_STATUS_LICENSE_BROKEN =( -21)
 
const Int32 AILIA_STATUS_LICENSE_EXPIRED =( -22)
 
const Int32 AILIA_STATUS_NDIMENSION_SHAPE =( -23)
 
const Int32 AILIA_STATUS_OTHER_ERROR =(-128)
 
const String LIBRARY_NAME ="ailia"
 
const Int32 AILIA_FILE_CALLBACK_VERSION = 1
 
const Int32 AILIA_SHAPE_VERSION = (1)
 
const int AILIA_MULTITHREAD_AUTO = (0)
 
const int AILIA_ENVIRONMENT_ID_AUTO = (-1)
 
const int AILIA_ENVIRONMENT_VERSION = (2)
 
const int AILIA_ENVIRONMENT_TYPE_CPU = (0)
 
const int AILIA_ENVIRONMENT_TYPE_BLAS = (1)
 
const int AILIA_ENVIRONMENT_TYPE_GPU = (2)
 
const int AILIA_ENVIRONMENT_TYPE_REMOTE = (3)
 
const int AILIA_ENVIRONMENT_BACKEND_NONE = (0)
 
const int AILIA_ENVIRONMENT_BACKEND_CUDA = (2)
 
const int AILIA_ENVIRONMENT_BACKEND_MPS = (3)
 
const int AILIA_ENVIRONMENT_BACKEND_VULKAN = (6)
 
const int AILIA_ENVIRONMENT_PROPERTY_NORMAL = (0)
 
const int AILIA_ENVIRONMENT_PROPERTY_LOWPOWER = (1)
 
const int AILIA_ENVIRONMENT_PROPERTY_FP16 = (2)
 
const Int32 AILIA_MEMORY_NO_OPTIMIZATION = (0)
 
const Int32 AILIA_MEMORY_REDUCE_CONSTANT = (1)
 
const Int32 AILIA_MEMORY_REDUCE_CONSTANT_WITH_INPUT_INITIALIZER = (2)
 
const Int32 AILIA_MEMORY_REDUCE_INTERSTAGE = (4)
 
const Int32 AILIA_MEMORY_REUSE_INTERSTAGE = (8)
 
const Int32 AILIA_MEMORY_REDUCE_CONSTANT_WITH_FILE_MAPPED = (16)
 
const Int32 AILIA_MEMORY_OPTIMAIZE_DEFAULT = (AILIA_MEMORY_REDUCE_CONSTANT)
 
const UInt32 AILIA_PROFILE_DISABLE = (0x00)
 
const UInt32 AILIA_PROFILE_AVERAGE = (0x01)
 

Member Function Documentation

◆ ailiaCallbackClose()

delegate Int32 Ailia.ailiaCallbackClose ( IntPtr  fp)

◆ ailiaCallbackOpen()

delegate IntPtr Ailia.ailiaCallbackOpen ( IntPtr  args)

◆ ailiaCallbackRead()

delegate Int32 Ailia.ailiaCallbackRead ( IntPtr  dest,
Int64  size,
IntPtr  fp 
)

◆ ailiaCallbackSeek()

delegate Int32 Ailia.ailiaCallbackSeek ( IntPtr  fp,
Int64  offset 
)

◆ ailiaCallbackSize()

delegate Int64 Ailia.ailiaCallbackSize ( IntPtr  fp)

◆ ailiaCallbackTell()

delegate Int64 Ailia.ailiaCallbackTell ( IntPtr  fp)

◆ ailiaCopyBlobData()

static int Ailia.ailiaCopyBlobData ( IntPtr  dst_net,
UInt32  dst_blob_idx,
IntPtr  src_net,
UInt32  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 .

◆ ailiaCreate()

static int Ailia.ailiaCreate ( ref IntPtr  net,
int  env_id,
int  num_thread 
)

Create a network object.

Parameters
netPointer to network object pointer
env_idID of the environment to use for calculation (obtained with ailiaGetEnvironment()) AILIA_ENVIRONMENT_ID_AUTO If set to AILIA_ENVIRONMENT_ID_AUTO, it is automatically selected
num_threadNumber of threads, automatic if AILIA_MULTITHREAD_AUTO
Returns
Returns AILIA_STATUS_SUCCESS if successful, otherwise returns an error code. Create network object. If the inference execution environment is set to automatic, CPU mode is used, and if BLAS is available, BLAS is used. Note that num_thread may be ignored when BLAS is used.

◆ ailiaDestroy()

static void Ailia.ailiaDestroy ( IntPtr  net)

destroy network object *

Parameters
netnetwork object pointer
netNetwork object pointer

◆ ailiaDisableLayerFusion()

static int Ailia.ailiaDisableLayerFusion ( IntPtr  net)

Disables layer integration during inference.

Parameters
netNetwork object pointer
Returns
If successful, returns AILIA_STATUS_SUCCESS, otherwise returns an error code.

This is used when it is necessary to retrieve a Blob that can no longer be retrieved due to layer integration, etc. * Must be specified immediately after ailiaCreate(). Must be specified immediately after ailiaCreate(); it cannot be changed after a call to ailiaOpen. Note that disabling layer integration may reduce inference speed.

◆ ailiaFinalize()

static int Ailia.ailiaFinalize ( )

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.

◆ ailiaFindBlobIndexByName()

static int Ailia.ailiaFindBlobIndexByName ( IntPtr  net,
ref UInt32  blob_idx,
string  name 
)

Find and get the index of the internal data (Blob) at inference time by name.

Parameters
netNetwork object pointer
blob_idxIndex of blob (0~ ailiaGetBlobCount() -1)
nameBlob name to search
Returns
If the function is successful, return AILIA_STATUS_SUCCESS, otherwise return error code.

◆ ailiaFindBlobNameByIndex()

static int Ailia.ailiaFindBlobNameByIndex ( IntPtr  net,
IntPtr  buffer,
UInt32  buffer_size,
UInt32  blob_idx 
)

◆ ailiaGetBlobCount()

static int Ailia.ailiaGetBlobCount ( IntPtr  net,
ref UInt32  blob_count 
)

Get the number of internal data (Blob) at inference.

Parameters
netNetwork object pointer
blob_countWhere to store the number of blobs
Returns
If the function is successful, return AILIA_STATUS_SUCCESS, otherwise return error code.

◆ ailiaGetBlobData()

static int Ailia.ailiaGetBlobData ( IntPtr  net,
IntPtr  dest,
UInt32  dest_size,
UInt32  blob_idx 
)

Get internal data (Blob) at inference time.

Parameters
netNetwork object pointer
destBuffer to which inference result is written out Stored in numeric type in the order of X,Y,Z,W
dest_sizeNumber of bytes in the buffer to which inference results are written
blob_idxIndex of blob (0 to ailiaGetBlobCount() -1)
Returns
AILIA_STATUS_SUCCESS if successful, otherwise return error code.

If ailiaPredict() has never been executed, then AILIA_STATUS_INVALID_STATE is returned.

◆ ailiaGetBlobDim()

static int Ailia.ailiaGetBlobDim ( IntPtr  net,
ref UInt32  dim,
UInt32  blob_idx 
)

Get the dimension of the internal data (Blob) at the time of inference.

Parameters
netNetwork object pointer
dimWhere blob's dimension is stored
blob_idxIndex of blob (0~ ailiaGetBlobCount() -1)
Returns
Return AILIA_STATUS_SUCCESS in case of success, error code in case of other errors.

◆ ailiaGetBlobIndexByInputIndex()

static int Ailia.ailiaGetBlobIndexByInputIndex ( IntPtr  net,
ref UInt32  blob_idx,
UInt32  input_blob_idx 
)

Get the index of the input data (Blob)

Parameters
netNetwork object pointer
blob_idxIndex in blob (0~ ailiaGetBlobCount() -1)
input_blob_idxIndex in input blob (0~ ailiaGetInputBlobCount() -1)
Returns
return AILIA_STATUS_SUCCESS if successful, otherwise return error code *
Parameters
input_blob_idx

◆ ailiaGetBlobIndexByOutputIndex()

static int Ailia.ailiaGetBlobIndexByOutputIndex ( IntPtr  net,
ref UInt32  blob_idx,
UInt32  output_blob_idx 
)

get index of output data (Blob)

Parameters
netNetwork object pointer
blob_idxIndex in blob (0~ ailiaGetBlobCount() -1)
output_blob_idxIndex in output blob (0~ ailiaGetOutputBlobCount() -1)
Returns
If successful, returns AILIA_STATUS_SUCCESS, otherwise returns an error code.

◆ ailiaGetBlobNameLengthByIndex()

static int Ailia.ailiaGetBlobNameLengthByIndex ( IntPtr  net,
UInt32  blob_idx,
ref UInt32  buffer_size 
)

Output the required buffer size for the name of the internal data (Blob).

Parameters
netNetwork object pointer
blob_idxIndex of blob (0~ ailiaGetBlobCount() -1)
buffer_sizeBuffer size required to output Blob name (including terminating null character)
Returns
If the function is successful, return AILIA_STATUS_SUCCESS, otherwise return error code.

◆ ailiaGetBlobShape()

static int Ailia.ailiaGetBlobShape ( IntPtr  net,
[In, Out] AILIAShape  shape,
UInt32  blob_idx,
UInt32  version 
)

Get the shape of the internal data (Blob) at the time of inference.

Parameters
netNetwork object pointer
shapeShape information of input data
blob_idxIndex of blob (0~ ailiaGetBlobCount() -1)
versionAILIA_SHAPE_VERSION
Returns
If the function is successful, return AILIA_STATUS_SUCCESS, otherwise return error code.

◆ ailiaGetBlobShapeND()

static int Ailia.ailiaGetBlobShapeND ( IntPtr  net,
UInt32 []  shape,
UInt32  dim,
UInt32  blob_idx 
)

Get the shape of the internal data (Blob) at the time of inference.

Parameters
netNetwork object pointer
shapeArray to store the size of each dimension of the blob (stored in dim-1, dim-2, ... ,1, 0 in that order)
dimDimension of shape
blob_idxIndex of the blob (0 to ailiaGetBlobCount() -1)
Returns
Return AILIA_STATUS_SUCCESS in case of success, error code in case of other errors.

◆ ailiaGetEnvironment()

static int Ailia.ailiaGetEnvironment ( ref IntPtr  env,
UInt32  env_idx,
UInt32  version 
)

◆ ailiaGetEnvironmentCount()

static int Ailia.ailiaGetEnvironmentCount ( ref Int32  env_count)

Get the number of available computing environments (CPU, GPU)

Parameters
env_countWhere to store the number of environment information
Returns
Number of available environments

◆ ailiaGetErrorDetail()

static IntPtr Ailia.ailiaGetErrorDetail ( IntPtr  net)

Returns error details.

Parameters
netNetwork object pointer
Returns
Error Details

The return value does not need to be released. The string is valid until the next call to ailia's API. Convert from the point obtained to a string as follows

Marshal.PtrToStringAnsi(Ailia.ailiaGetErrorDetail(net))

◆ ailiaGetInputBlobCount()

static int Ailia.ailiaGetInputBlobCount ( IntPtr  net,
ref UInt32  input_blob_count 
)

Get the number of input data (Blob).

Parameters
netNetwork object pointer
input_blob_countWhere to store the number of input blobs
Returns
If the function is successful, return AILIA_STATUS_SUCCESS, otherwise return error code.

◆ ailiaGetInputDim()

static int Ailia.ailiaGetInputDim ( IntPtr  net,
ref UInt32  dim 
)

Get the dimension of the input data during inference.

Parameters
netNetwork object pointer
dimWhere dimension of input data is stored
Returns
Returns AILIA_STATUS_SUCCESS in case of success, error code in case of other errors.

◆ ailiaGetInputShape()

static int Ailia.ailiaGetInputShape ( IntPtr  net,
[In, Out] AILIAShape  shape,
UInt32  version 
)

Get the shape of the input data during inference.

Parameters
netNetwork object pointer
shapeShape information of input data
Returns
If the function successful AILIA_STATUS_SUCCESS , if more than 5 dimensions AILIA_STATUS_NDIMENSION_SHAPE , if more than 5 dimensions If the geometry is partially undetermined AILIA_STATUS_UNSETTLED_SHAPE, otherwise return the error code.

Use ailiaGetInputDim() or ailiaGetInputShapeND() if the shape has more than 5 dimensions. If a part of the shape is undefined, the value of the corresponding dimension is set to 0, and the values of the other dimensions are stored as valid values.

◆ ailiaGetInputShapeND()

static int Ailia.ailiaGetInputShapeND ( IntPtr  net,
UInt32 []  shape,
UInt32  dim 
)

Get the shape of the input data during inference.

Parameters
netNetwork object pointer
shapeArray to store the size of each dimension of the input data (stored in dim-1, dim-2, ... ,1, 0 in that order)
dimDimension of shape
Returns
If successful, AILIA_STATUS_SUCCESS, if part of the shape is not yet determined, AILIA_STATUS_UNSETTLED_SHAPE, if not yet determined, Return error code in case of other errors.

If a part of the shape is not yet determined, the value of the corresponding dimension is set to 0, and valid values are stored for the other dimensions.

◆ ailiaGetOutputBlobCount()

static int Ailia.ailiaGetOutputBlobCount ( IntPtr  net,
ref UInt32  output_blob_count 
)

Get the number of output data (Blob).

Parameters
netNetwork object pointer
output_blob_countWhere to store the number of output blobs
Returns
If successful, return AILIA_STATUS_SUCCESS, otherwise return error code.

◆ ailiaGetOutputDim()

static int Ailia.ailiaGetOutputDim ( IntPtr  net,
ref UInt32  dim 
)

Get the dimension of the output data during inference.

Parameters
netNetwork object pointer
dimWhere dimension of output data is stored
Returns
Returns AILIA_STATUS_SUCCESS in case of success, error code in case of other errors.

◆ ailiaGetOutputShape()

static int Ailia.ailiaGetOutputShape ( IntPtr  net,
[In, Out] AILIAShape  shape,
UInt32  version 
)

Get the shape of the output data during inference and training.

Parameters
netNetwork object pointer
shapeShape information of output data
Returns
In case of success AILIA_STATUS_SUCCESS, in case of 5 or more dimensions AILIA_STATUS_NDIMENSION_SHAPE. Return error code in case of other errors.

Use ailiaGetOutputDim() and ailiaGetOutputShapeND() if the shape has more than 5 dimensions.

◆ ailiaGetOutputShapeND()

static int Ailia.ailiaGetOutputShapeND ( IntPtr  net,
UInt32 []  shape,
UInt32  dim 
)

Get the shape of the output data during inference.

Parameters
netNetwork object pointer
shapeArray to store the size of each dimension of output data (stored in dim-1, dim-2, ... ,1, 0 in that order)
dimDimension of shape
Returns
Return AILIA_STATUS_SUCCESS in case of success, error code in case of other errors.

◆ ailiaGetSelectedEnvironment()

static int Ailia.ailiaGetSelectedEnvironment ( IntPtr  net,
ref IntPtr  env,
UInt32  version 
)

Get the selected computing environment.

Parameters
netNetwork object pointer
envWhere computation environment information is stored (valid until AILIANetwork instance is destroyed)
versionAILIA_ENVIRONMENT_VERSION
Returns
If successful, return AILIA_STATUS_SUCCESS, otherwise return error code.

◆ ailiaGetStatusString()

static IntPtr Ailia.ailiaGetStatusString ( Int32  status)

Returns a string describing the status code.

Parameters
statusStatus code
Returns
String describing the status code

The return value does not need to be released. The string is valid until the ailia library is unloaded. Convert from the point obtained to a string as follows

Marshal.PtrToStringAnsi(Ailia.ailiaGetStatusString(status))

◆ ailiaGetSummaryLength()

static int Ailia.ailiaGetSummaryLength ( IntPtr  net,
ref UInt32  buffer_size 
)

Output the required buffer size for network Summary.

Parameters
netNetwork object pointer
buffer_sizeWhere buffer size is stored (including terminating null character)
Returns
If the function is successful, return AILIA_STATUS_SUCCESS, otherwise return error code.

◆ ailiaGetVersion()

static IntPtr Ailia.ailiaGetVersion ( )

Get the library version.

Returns
Version number (can be converted to string with Marshal.PtrToStringAnsi)

The return value does not need to be released.

◆ ailiaOpenStreamEx()

static int Ailia.ailiaOpenStreamEx ( IntPtr  net,
IntPtr  fopen_args,
ailiaFileCallback  callback,
Int32  version 
)

Initialize network object. (user-defined file access callback)

Parameters
netNetwork object pointer
fopen_argsArgument pointer notified to AILIA_USER_API_FOPEN
callbackUser-defined file access callback structure
versionVersion of the file access callback structure (AILIA_FILE_CALLBACK_VERSION )
Returns
If the function is successful, returns the file access callback structure version (AILIA_FILE_CALLBACK_VERSION ), otherwise returns an error code.

Read from file and initialize network object.

◆ ailiaOpenStreamFile()

static int Ailia.ailiaOpenStreamFile ( IntPtr  net,
string  path 
)

Initialize network object. (read from file)

Parameters
netNetwork object pointer
pathPathname of prototxt file (MBSC or UTF16)
Returns
Return AILIA_STATUS_SUCCESS if succeeded, otherwise return error code.

Initialize the network object by reading from the file.

◆ ailiaOpenStreamMem()

static int Ailia.ailiaOpenStreamMem ( IntPtr  net,
byte []  buf,
UInt32  buf_size 
)

Initialize network object. (read from memory)

Parameters
netNetwork object pointer
bufPointer to data in prototxt file
buf_sizeData size of prototxt file
Returns
If the function is successful, return AILIA_STATUS_SUCCESS, otherwise return error code *

Read from memory and initialize the network object.

◆ ailiaOpenWeightEx()

static int Ailia.ailiaOpenWeightEx ( IntPtr  net,
IntPtr  fopen_args,
ailiaFileCallback  callback,
Int32  version 
)

Load weight coefficients into network object. (user-defined file access callback)

Parameters
netNetwork object pointer
fopen_argsArgument pointer notified to AILIA_USER_API_FOPEN
callbackUser-defined file access callback structure
versionVersion of the file access callback structure (AILIA_FILE_CALLBACK_VERSION )
Returns
Returns the file access callback structure version (AILIA_FILE_CALLBACK_VERSION ) if successful, otherwise returns an error code.

Load weights from a file into a network object.

◆ ailiaOpenWeightFile()

static int Ailia.ailiaOpenWeightFile ( IntPtr  net,
string  path 
)

Load weight coefficients into network object.

Parameters
netNetwork object pointer
pathPathname of protobuf/onnx file (MBSC or UTF16)
Returns
Return AILIA_STATUS_SUCCESS if successful, otherwise return error code.

Load weights from the file into the read network object.

◆ ailiaOpenWeightMem()

static int Ailia.ailiaOpenWeightMem ( IntPtr  net,
byte []  buf,
UInt32  buf_size 
)

Load weight coefficients into network object. (read from memory)

Parameters
netNetwork object pointer
bufPointer to data in protobuf/onnxf file
buf_sizeData size of protobuf/onnxf file
Returns
If the function successful, return AILIA_STATUS_SUCCESS, otherwise return error code *

Load weights from the file into the network object.

◆ ailiaPredict()

static int Ailia.ailiaPredict ( IntPtr  net,
IntPtr  dest,
UInt32  dest_size,
IntPtr  src,
UInt32  src_size 
)

Infer and get the result of inference.

Parameters
netNetwork object pointer
destBuffer to which inference result is written, stored in numeric type in the order of X,Y,Z,W Size is outputSize of net file
dest_sizeNumber of bytes in the buffer to which inference results are written
srcInference data X,Y,Z,W stored in order by numeric type Size is inputSize of net file
src_sizeNumber of bytes of inference data
Returns
If the function is successful, returns AILIA_STATUS_SUCCESS, otherwise returns an error code.

◆ ailiaSetInputBlobData()

static int Ailia.ailiaSetInputBlobData ( IntPtr  net,
IntPtr  src,
UInt32  src_size,
UInt32  blob_idx 
)

Give input data to the specified Blob.

Parameters
netNetwork object pointer
srcInference data X,Y,Z,W stored in order by numeric type Size is inputSize of net file
src_sizeInference data size
blob_idxIndex of input blob
Returns
If successful, return AILIA_STATUS_SUCCESS, otherwise return error code.

This is used to specify an input in a network with multiple inputs, etc. * blob_idx is the index of the input blob. If blob_idx is specified other than blob of input layer AILIA_STATUS_INVALID_ARGUMENT} is returned.

◆ ailiaSetInputBlobShape()

static int Ailia.ailiaSetInputBlobShape ( IntPtr  net,
[In] AILIAShape  shape,
UInt32  blob_idx,
UInt32  version 
)

Change the shape of the specified Blob.

Parameters
netNetwork object pointer
shapeShape information of input data
blob_idxIndex of blob to be changed
versionAILIA_SHAPE_VERSION
Returns
Return AILIA_STATUS_SUCCESS if succeeded, otherwise return error code.

This is used to change the input shape in networks with multiple inputs, etc. If blob_idx is specified other than blob of input layer AILIA_STATUS_INVALID_ARGUMENT} is returned. See the description of ailiaSetInputShape() for other notes. If the input shape has a rank of 5 or more dimensions, use ailiaSetInputBlobShapeND().

◆ ailiaSetInputBlobShapeND()

static int Ailia.ailiaSetInputBlobShapeND ( IntPtr  net,
UInt32 []  shape,
UInt32  dim,
UInt32  blob_idx 
)

Change the shape of the specified Blob.

Parameters
netNetwork object pointer
shapeArray of sizes of each dimension of input data (dim-1, dim-2, ... ,1, 0)
dimdim Dimension of shape
blob_idxIndex of blob to be changed
Returns
Return AILIA_STATUS_SUCCESS if successful, otherwise return error code.

This is used to change the input shape in a network with multiple inputs, etc. If blob_idx is specified other than blob of input layer AILIA_STATUS_INVALID_ARGUMENT} is returned. See the description of ailiaSetInputShapeND() for other notes.

◆ ailiaSetInputShape()

static int Ailia.ailiaSetInputShape ( IntPtr  net,
[In] AILIAShape  shape,
UInt32  version 
)

Change the shape of input data during inference.

Parameters
netNetwork object pointer
shapeShape information of input data
versionAILIA_SHAPE_VERSION
Returns
Return AILIA_STATUS_SUCCESS if successful, otherwise return error code *

Change the input shape defined in prototxt. Must be the same as the rank described in prototxt. Note that an error code may be returned if the shape of the weight coefficients depends on the input shape. If the rank defined in prototxt is more than 5 dimensions, use ailiaSetInputShapeND().

◆ ailiaSetInputShapeND()

static int Ailia.ailiaSetInputShapeND ( IntPtr  net,
UInt32 []  shape,
UInt32  dim 
)

Change the shape of input data during inference.

Parameters
netNetwork object pointer
shapeArray of sizes of each dimension of input data (dim-1, dim-2, ... ,1, 0)
dimDimension of shape
Returns
Return AILIA_STATUS_SUCCESS if successful, otherwise return error code.

Change the input shape defined in prototxt. Must be the same as the rank described in prototxt. Note that an error may be returned due to the shape of the weight coefficients being dependent on the input shape, etc.

◆ ailiaSetMemoryMode()

static int Ailia.ailiaSetMemoryMode ( IntPtr  net,
UInt32  mode 
)

Sets the memory usage policy during inference.

Parameters
netnetwork object pointer
modeMemory mode (multiple specifiable by logical OR) AILIA_MEMORY_XXX (default: AILIA_MEMORY_REDUCE_CONSTANT )
Returns
If successful, returns AILIA_STATUS_SUCCESS, otherwise returns an error code.

Change the memory usage policy. If you specify anything other than AILIA_MEMORY_NO_OPTIMIZATION The amount of memory used during inference can be reduced because the intermediate buffer allocated during inference is released. It must be specified immediately after ailiaCreate(); it cannot be changed after a call to ailiaOpen. Note that if you specify that intermediate buffers are to be released, calling ailiaGetBlobData() for the corresponding Blob will return AILIA_STATUS_DATA_HIDDEN error will be returned.

◆ ailiaSetProfileMode()

static int Ailia.ailiaSetProfileMode ( IntPtr  net,
UInt32  mode 
)

Set profile mode.

Parameters
netnetwork object pointer
modeprofile mode
Returns
If successful, returns AILIA_STATUS_SUCCESS, otherwise returns an error code.

Specifies the profile mode. Default is disabled. Call it after calling ailiaOpenStreamXXX. If profile mode is enabled, the profile result is added to the output of ailiaSummary().

◆ ailiaSetTemporaryCachePath()

static int Ailia.ailiaSetTemporaryCachePath ( string  path)

Specify temporary cache directory.

Parameters
cache_dirtemporary cache directory
Returns
If successful, return AILIA_STATUS_SUCCESS, otherwise return error code.

The specified cache directory is used by the system to generate and store machine code optimized for each inference execution environment. Only one call should be made at the start of ailia execution. For the second and subsequent calls, ignore them and return success. No particular problem occurs when called by multiple threads because of the internal exclusion control. Some functions, such as Vulkan's shader cache function, cannot be used until this API is called. Specify the file path obtained by Context.getCacheDir() for cache_dir.

◆ ailiaSummary()

static int Ailia.ailiaSummary ( IntPtr  net,
byte []  buffer,
UInt32  buffer_size 
)

Display the name and shape of each Blob.

Parameters
netNetwork object pointer
bufferOutput destination of summary
buffer_sizeSize of output buffer (including terminating null characters). Set the value obtained with ailiaGetSummaryLength().
Returns
Returns AILIA_STATUS_SUCCESS if successful, otherwise returns error code.

◆ ailiaUpdate()

static int Ailia.ailiaUpdate ( IntPtr  net)

Perform inference with pre-specified input data.

Parameters
netNetwork object pointer
Returns
Returns AILIA_STATUS_SUCCESS if successful, otherwise returns an error code.

This is used when input is given using ailiaSetInputBlobData(), etc. Get the inference result with ailiaGetBlobData().

Member Data Documentation

◆ AILIA_ENVIRONMENT_BACKEND_CUDA

const int Ailia.AILIA_ENVIRONMENT_BACKEND_CUDA = (2)

◆ AILIA_ENVIRONMENT_BACKEND_MPS

const int Ailia.AILIA_ENVIRONMENT_BACKEND_MPS = (3)

◆ AILIA_ENVIRONMENT_BACKEND_NONE

const int Ailia.AILIA_ENVIRONMENT_BACKEND_NONE = (0)

◆ AILIA_ENVIRONMENT_BACKEND_VULKAN

const int Ailia.AILIA_ENVIRONMENT_BACKEND_VULKAN = (6)

◆ AILIA_ENVIRONMENT_ID_AUTO

const int Ailia.AILIA_ENVIRONMENT_ID_AUTO = (-1)

◆ AILIA_ENVIRONMENT_PROPERTY_FP16

const int Ailia.AILIA_ENVIRONMENT_PROPERTY_FP16 = (2)

Indicates that it works with FP16.

◆ AILIA_ENVIRONMENT_PROPERTY_LOWPOWER

const int Ailia.AILIA_ENVIRONMENT_PROPERTY_LOWPOWER = (1)

Indicates the use of a power-saving GPU (e.g., built-in GPU) (for MPS).

◆ AILIA_ENVIRONMENT_PROPERTY_NORMAL

const int Ailia.AILIA_ENVIRONMENT_PROPERTY_NORMAL = (0)

◆ AILIA_ENVIRONMENT_TYPE_BLAS

const int Ailia.AILIA_ENVIRONMENT_TYPE_BLAS = (1)

◆ AILIA_ENVIRONMENT_TYPE_CPU

const int Ailia.AILIA_ENVIRONMENT_TYPE_CPU = (0)

◆ AILIA_ENVIRONMENT_TYPE_GPU

const int Ailia.AILIA_ENVIRONMENT_TYPE_GPU = (2)

◆ AILIA_ENVIRONMENT_TYPE_REMOTE

const int Ailia.AILIA_ENVIRONMENT_TYPE_REMOTE = (3)

◆ AILIA_ENVIRONMENT_VERSION

const int Ailia.AILIA_ENVIRONMENT_VERSION = (2)

◆ AILIA_FILE_CALLBACK_VERSION

const Int32 Ailia.AILIA_FILE_CALLBACK_VERSION = 1

◆ AILIA_MEMORY_NO_OPTIMIZATION

const Int32 Ailia.AILIA_MEMORY_NO_OPTIMIZATION = (0)

Intermediate buffers are not opened.

◆ AILIA_MEMORY_OPTIMAIZE_DEFAULT

const Int32 Ailia.AILIA_MEMORY_OPTIMAIZE_DEFAULT = (AILIA_MEMORY_REDUCE_CONSTANT)

◆ AILIA_MEMORY_REDUCE_CONSTANT

const Int32 Ailia.AILIA_MEMORY_REDUCE_CONSTANT = (1)

Open intermediate buffers that are constants for weights, etc.

◆ AILIA_MEMORY_REDUCE_CONSTANT_WITH_FILE_MAPPED

const Int32 Ailia.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

const Int32 Ailia.AILIA_MEMORY_REDUCE_CONSTANT_WITH_INPUT_INITIALIZER = (2)

The input designation initializer is made unchangeable, and intermediate buffers that are constants for weights, etc., are released.

◆ AILIA_MEMORY_REDUCE_INTERSTAGE

const Int32 Ailia.AILIA_MEMORY_REDUCE_INTERSTAGE = (4)

Open intermediate buffers during inference.

◆ AILIA_MEMORY_REUSE_INTERSTAGE

const Int32 Ailia.AILIA_MEMORY_REUSE_INTERSTAGE = (8)

Share intermediate buffers to infer. When used with AILIA_MEMORY_REDUCE_INTERSTAGE, the shareable intermediate buffer is not released.

◆ AILIA_MULTITHREAD_AUTO

const int Ailia.AILIA_MULTITHREAD_AUTO = (0)

◆ AILIA_PROFILE_AVERAGE

const UInt32 Ailia.AILIA_PROFILE_AVERAGE = (0x01)

◆ AILIA_PROFILE_DISABLE

const UInt32 Ailia.AILIA_PROFILE_DISABLE = (0x00)

◆ AILIA_SHAPE_VERSION

const Int32 Ailia.AILIA_SHAPE_VERSION = (1)

◆ AILIA_STATUS_BROKEN

const Int32 Ailia.AILIA_STATUS_BROKEN =( -4)

Incorrect stream version or structure version

◆ AILIA_STATUS_DATA_HIDDEN

const Int32 Ailia.AILIA_STATUS_DATA_HIDDEN =( -19)

It was information that could not be retrieved from the application.

◆ AILIA_STATUS_DATA_REMOVED

const Int32 Ailia.AILIA_STATUS_DATA_REMOVED =AILIA_STATUS_DATA_HIDDEN

Removed by optimization, etc.

◆ AILIA_STATUS_ERROR_FILE_API

const Int32 Ailia.AILIA_STATUS_ERROR_FILE_API =( -2)

File access failed.

◆ AILIA_STATUS_EXPIRED

const Int32 Ailia.AILIA_STATUS_EXPIRED =( -17)

Model expiration

◆ AILIA_STATUS_GPU_ERROR

const Int32 Ailia.AILIA_STATUS_GPU_ERROR =( -14)

Error during processing on GPU

◆ AILIA_STATUS_GPU_UNSUPPORT_LAYER

const Int32 Ailia.AILIA_STATUS_GPU_UNSUPPORT_LAYER =( -13)

Given a layer parameter not yet supported by the GPU

◆ AILIA_STATUS_INVALID_ARGUMENT

const Int32 Ailia.AILIA_STATUS_INVALID_ARGUMENT =( -1)

Invalid argument

◆ AILIA_STATUS_INVALID_LAYER

const Int32 Ailia.AILIA_STATUS_INVALID_LAYER =( -10)

Incorrect layer weights, input shapes, etc.

◆ AILIA_STATUS_INVALID_PARAMINFO

const Int32 Ailia.AILIA_STATUS_INVALID_PARAMINFO =( -11)

Invalid parameter file content

◆ AILIA_STATUS_INVALID_STATE

const Int32 Ailia.AILIA_STATUS_INVALID_STATE =( -7)

Internal state of decoder is incorrect

◆ AILIA_STATUS_INVALID_VERSION

const Int32 Ailia.AILIA_STATUS_INVALID_VERSION =( -3)

◆ AILIA_STATUS_LICENSE_BROKEN

const Int32 Ailia.AILIA_STATUS_LICENSE_BROKEN =( -21)

License is broken.

◆ AILIA_STATUS_LICENSE_EXPIRED

const Int32 Ailia.AILIA_STATUS_LICENSE_EXPIRED =( -22)

License expiration

◆ AILIA_STATUS_LICENSE_NOT_FOUND

const Int32 Ailia.AILIA_STATUS_LICENSE_NOT_FOUND =( -20)

Cannot find a valid license

◆ AILIA_STATUS_MEMORY_INSUFFICIENT

const Int32 Ailia.AILIA_STATUS_MEMORY_INSUFFICIENT =( -5)

Insufficient memory

◆ AILIA_STATUS_NDIMENSION_SHAPE

const Int32 Ailia.AILIA_STATUS_NDIMENSION_SHAPE =( -23)

Indicates that the shape is more than 5 dimensional

◆ AILIA_STATUS_NOT_FOUND

const Int32 Ailia.AILIA_STATUS_NOT_FOUND =( -12)

The specified element could not be found.

◆ AILIA_STATUS_OTHER_ERROR

const Int32 Ailia.AILIA_STATUS_OTHER_ERROR =(-128)

Unknown error

◆ AILIA_STATUS_PERMISSION_DENIED

const Int32 Ailia.AILIA_STATUS_PERMISSION_DENIED =( -16)

Unauthorized operations

◆ AILIA_STATUS_SUCCESS

const Int32 Ailia.AILIA_STATUS_SUCCESS =( 0)

Success

◆ AILIA_STATUS_THREAD_ERROR

const Int32 Ailia.AILIA_STATUS_THREAD_ERROR =( -6)

Failed to create thread.

◆ AILIA_STATUS_UNIMPLEMENTED

const Int32 Ailia.AILIA_STATUS_UNIMPLEMENTED =( -15)

uninstalled

◆ AILIA_STATUS_UNSETTLED_SHAPE

const Int32 Ailia.AILIA_STATUS_UNSETTLED_SHAPE =( -18)

Shape not yet determined

◆ AILIA_STATUS_UNSUPPORT_NET

const Int32 Ailia.AILIA_STATUS_UNSUPPORT_NET =( -9)

Unsupported Networks

◆ LIBRARY_NAME

const String Ailia.LIBRARY_NAME ="ailia"

The documentation for this class was generated from the following file: