11 #ifndef COM_AXIS_LAROD_H    12 #define COM_AXIS_LAROD_H    19 #include "larod-version.h"    25 #if defined(LAROD_API_VERSION_1) && defined(LAROD_API_VERSION_2)    26 #error API version ambiguous, specify at most one version \    27     (#define LAROD_API_VERSION_*) before including larod.h    33 #define LAROD_TENSOR_MAX_LEN 12    38 #define LAROD_INVALID_MODEL_ID UINT64_MAX    43 #define LAROD_INVALID_FD (INT_MIN)    66 #define LAROD_FD_PROP_READWRITE (1UL << 0)    68 #define LAROD_FD_PROP_MAP (1UL << 1)    70 #define LAROD_FD_PROP_DMABUF (1UL << 2)    82 #define LAROD_FD_TYPE_DMA (LAROD_FD_PROP_DMABUF | LAROD_FD_PROP_MAP)    84 #define LAROD_FD_TYPE_DISK (LAROD_FD_PROP_READWRITE | LAROD_FD_PROP_MAP)   104 #if defined(LAROD_API_VERSION_1) || defined(LAROD_API_VERSION_2) ||            \   105     defined(LAROD_DOXYGEN)   171 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)   460 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)   482 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)   609 #if defined(LAROD_API_VERSION_1) || defined(LAROD_API_VERSION_2)   624 const char* larodGetChipName(
const larodChip chip);
   627 #if defined(LAROD_API_VERSION_1) || defined(LAROD_API_VERSION_2) ||            \   628     defined(LAROD_DOXYGEN)   675 #if defined(LAROD_API_VERSION_1)   679 #define larodLoadModel larodLoadModel_API_VERSION_1   680 #elif defined(LAROD_API_VERSION_2)   687 #define larodLoadModel larodLoadModel_API_VERSION_2   715                            const char* name, 
const larodMap* params,
   720 #if defined(LAROD_API_VERSION_1)   721 bool larodLoadModelAsync_API_VERSION_1(
larodConnection* conn, 
const int fd,
   726 #define larodLoadModelAsync larodLoadModelAsync_API_VERSION_1   727 #elif defined(LAROD_API_VERSION_2)   728 bool larodLoadModelAsync_API_VERSION_2(
larodConnection* conn, 
const int fd,
   731                                        const char* name, 
const larodMap* params,
   734 #define larodLoadModelAsync larodLoadModelAsync_API_VERSION_2   760                          const char* name, 
const larodMap* params,
   870 #if defined(LAROD_API_VERSION_2) || defined(LAROD_DOXYGEN)  1127                                     const uint32_t fdPropFlags,
  1128                                     size_t* numTensors, 
larodMap* params,
  1178                                      const uint32_t fdPropFlags,
  1179                                      size_t* numTensors, 
larodMap* params,
  1211 #if defined(LAROD_API_VERSION_1) || defined(LAROD_API_VERSION_2)  1212 void larodDestroyTensors_API_VERSION_1(
larodTensor*** tensors,
  1214 #define larodDestroyTensors larodDestroyTensors_API_VERSION_1  1338                             const larodTensorDataType dataType,
  1713                         const int64_t value1, 
const int64_t value2,
  1826                                        size_t numOutputs, 
larodMap* params,
  1872                               const size_t numTensors, 
larodError** error);
  1889                                const size_t numTensors, 
larodError** error);
  2017 #ifdef LAROD_DOXYGEN  2049 #ifdef LAROD_DOXYGEN  2082                            const char* name, 
const larodMap* params,
  2086 #ifdef LAROD_DOXYGEN  2116 #ifdef LAROD_DOXYGEN  2147                          const char* name, 
const larodMap* params,
  2152 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)  2190 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)  2205 #define larodDestroyInferenceRequest larodDestroyJobRequest  2208 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)  2230 #define larodSetInferenceRequestModel larodSetJobRequestModel  2233 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)  2255                                     const size_t numTensors,
  2257 #define larodSetInferenceRequestInputs larodSetJobRequestInputs  2260 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)  2282                                      const size_t numTensors,
  2284 #define larodSetInferenceRequestOutputs larodSetJobRequestOutputs  2287 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)  2327                                       const uint8_t priority,
  2329 #define larodSetInferenceRequestPriority larodSetJobRequestPriority  2332 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)  2366 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)  2412 #if defined(LAROD_API_VERSION_2) || defined(LAROD_DOXYGEN)  2417 #define larodRunJobAsync larodRunJobAsync_API_VERSION_2  2420 #if defined(LAROD_API_VERSION_2) || defined(LAROD_DOXYGEN)  2424 #define larodRunJob larodRunJob_API_VERSION_2  2427 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)  2446 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)  2465 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)  2487 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)  2506 #if defined(LAROD_DOXYGEN)  2531 #endif // COM_AXIS_LAROD_H const larodTensorDims * larodGetTensorDims(const larodTensor *tensor, larodError **error)
Get dimensions of a tensor. 
64-bit unsigned integer. 
Definition: larod.h:227
bool larodSetJobRequestInputs(larodJobRequest *jobReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set input tensor array in a request. 
Dummy chip for debugging. 
Definition: larod.h:119
Tensor mismatch. 
Definition: larod.h:198
Max errno value (dummy value). 
Definition: larod.h:204
int larodGetTensorFd(const larodTensor *tensor, larodError **error)
Get file descriptor of a tensor. 
size_t larodGetModelNumInputs(const larodModel *model, larodError **error)
Get number of input tensors for a model. 
Public access. 
Definition: larod.h:152
Error while allocating. 
Definition: larod.h:202
const larodDevice * larodGetDevice(const larodConnection *conn, const char *name, const uint32_t instance, larodError **error)
Get an available device. 
void larodDestroyMap(larodMap **map)
Destroy a larodMap. 
bool larodGetChipType(larodConnection *conn, larodChip *chipType, larodError **error)
Get current chip type in use for the session in larod. 
size_t * larodGetModelOutputByteSizes(const larodModel *model, size_t *numOutputs, larodError **error)
Get output tensor byte sizes for a model. 
Insufficient permissions. 
Definition: larod.h:184
bool larodSetTensorFdSize(larodTensor *tensor, const size_t size, larodError **error)
Set file descriptor maximum capacity (bytes) for a tensor. 
64-bit signed integer. 
Definition: larod.h:228
16-bit unsigned integer. 
Definition: larod.h:223
const char * larodMapGetStr(larodMap *map, const char *key, larodError **error)
Get string type value tied to given key. 
size_t larodGetModelSize(const larodModel *model, larodError **error)
Get model size. 
larodMap * larodCreateMap(larodError **error)
Create new larodMap. 
bool larodSetInferenceRequestModel(larodInferenceRequest *infReq, const larodModel *model, larodError **error)
Set model in an inference request. 
size_t len
Length of pitches array. 
Definition: larod.h:376
bool larodDeleteModel(larodConnection *conn, larodModel *model, larodError **error)
Delete a loaded model. 
larodTensorDataType larodGetTensorDataType(const larodTensor *tensor, larodError **error)
Get data type of a tensor. 
larodTensor ** larodCreateModelOutputs(const larodModel *model, size_t *numTensors, larodError **error)
Create output tensors from a model. 
bool larodRunInference(larodConnection *conn, const larodInferenceRequest *infReq, larodError **error)
Run inference on a loaded model. 
Private access. 
Definition: larod.h:151
16-bit floating point. 
Definition: larod.h:229
larodTensor ** larodCreateTensors(size_t numTensors, larodError **error)
Create a list of empty larodTensor handles. 
Invalid chip. 
Definition: larod.h:117
bool larodSetTensorDims(larodTensor *tensor, const larodTensorDims *dims, larodError **error)
Set the dimensions of a tensor. 
uint64_t larodGetModelId(const larodModel *model, larodError **error)
Get model ID. 
32-bit signed integer. 
Definition: larod.h:226
larodErrorCode code
Error code. 
Definition: larod.h:299
size_t len
Length of dims array. 
Definition: larod.h:322
bool larodSetJobRequestPriority(larodJobRequest *jobReq, const uint8_t priority, larodError **error)
Set an priority of a job request. 
Invalid access specifier. 
Definition: larod.h:194
8-bit unsigned integer. 
Definition: larod.h:221
bool larodSetChip(larodConnection *conn, const larodChip chip, larodError **error)
Set current chip using larodChip in use for the session in larod. 
bool larodListChips(larodConnection *conn, larodChip **chips, size_t *numChips, larodError **error)
List available chips. 
bool larodMapGetInt(larodMap *map, const char *key, int64_t *value, larodError **error)
Get an integer type value tied to given key. 
bool larodSetChipId(larodConnection *conn, const uint64_t chipId, larodError **error)
Set current chip using ID in use for the session in larod. 
bool larodMapSetIntArr4(larodMap *map, const char *key, const int64_t value0, const int64_t value1, const int64_t value2, const int64_t value3, larodError **error)
Add an integer array of four elements to a larodMap object. 
bool larodDisconnect(larodConnection **conn, larodError **error)
Disconnect from larod. 
Version mismatch. 
Definition: larod.h:200
16-bit signed integer. 
Definition: larod.h:224
void(* larodLoadModelCallback)(larodModel *model, void *userData, larodError *error)
Callback used in larodLoadModelAsync(). 
Definition: larod.h:406
larodTensorLayout
Enum type for specifying tensor layout. 
Definition: larod.h:270
bool larodSetTensorFdOffset(larodTensor *tensor, const int64_t offset, larodError **error)
Set file offset for a tensor. 
bool larodLoadModelAsync(larodConnection *conn, const int inFd, const larodDevice *dev, const larodAccess access, const char *name, const larodMap *params, larodLoadModelCallback callback, void *userData, larodError **error)
Load a new model asynchronously. 
Axis Compute Engine. 
Definition: larod.h:132
General error for loading model. 
Definition: larod.h:178
bool larodSetTensorDataType(larodTensor *tensor, const larodTensorDataType dataType, larodError **error)
Set data type of a tensor. 
larodTensor ** larodAllocModelOutputs(larodConnection *conn, const larodModel *model, const uint32_t fdPropFlags, size_t *numTensors, larodMap *params, larodError **error)
Create and allocate output tensors from a model. 
void(* larodRunInferenceCallback)(void *userData, larodError *error)
Callback used in larodRunInferenceAsync(). 
Definition: larod.h:479
bool larodGetTensorFdSize(const larodTensor *tensor, size_t *size, larodError **error)
Get file descriptor maximum capacity (bytes) for a tensor. 
#define LAROD_TENSOR_MAX_LEN
Maximum number of dimensions of a larodTensor. 
Definition: larod.h:33
bool larodMapSetIntArr2(larodMap *map, const char *key, const int64_t value0, const int64_t value1, larodError **error)
Add an integer array of two elements to a larodMap object. 
bool larodSetTensorLayout(larodTensor *tensor, const larodTensorLayout layout, larodError **error)
Set layout of a tensor. 
Max enum (dummy value). 
Definition: larod.h:288
General error for job. 
Definition: larod.h:170
Invalid access. 
Definition: larod.h:150
const char * larodGetTensorName(const larodTensor *tensor, larodError **error)
Get name of tensor. 
Image processing using OpenCL. 
Definition: larod.h:139
const int64_t * larodMapGetIntArr4(larodMap *map, const char *key, larodError **error)
Get an integer array of four elements tied to given key. 
Invalid chip ID. 
Definition: larod.h:192
struct larodDevice larodDevice
A type for representing a device. 
Definition: larod.h:102
bool larodSetInferenceRequestPriority(larodInferenceRequest *infReq, const uint8_t priority, larodError **error)
Set an priority of an inference request. 
larodTensor ** larodCreateModelInputs(const larodModel *model, size_t *numTensors, larodError **error)
Create input tensors from a model. 
larodTensor ** larodAllocModelInputs(larodConnection *conn, const larodModel *model, const uint32_t fdPropFlags, size_t *numTensors, larodMap *params, larodError **error)
Create and allocate input tensors from a model. 
larodJobRequest * larodCreateJobRequest(const larodModel *model, larodTensor **inputTensors, size_t numInputs, larodTensor **outputTensors, size_t numOutputs, larodMap *params, larodError **error)
Create and initialize a job request handle. 
A type containing information about a tensor's dimensions. 
Definition: larod.h:320
Ambarella CVFlow (NN). 
Definition: larod.h:125
struct larodModel larodModel
A type representing a model. 
Definition: larod.h:388
larodTensorDataType
Enum type for specifying tensor data type. 
Definition: larod.h:217
bool larodSetJobRequestParams(larodJobRequest *jobReq, const larodMap *params, larodError **error)
Set additional parameters to a job request. 
larodErrorCode
Enum type for error codes. 
Definition: larod.h:166
const char * msg
Error message. 
Definition: larod.h:300
32-bit floating point. 
Definition: larod.h:230
larodTensorLayout larodGetTensorLayout(const larodTensor *tensor, larodError **error)
Get layout of a tensor. 
struct larodJobRequest larodInferenceRequest
Type describing a job request. 
Definition: larod.h:492
bool larodSetTensorFdProps(larodTensor *tensor, const uint32_t fdPropFlags, larodError **error)
Set the properties for a file descriptor of a tensor. 
Type containing error information. 
Definition: larod.h:298
larodAccess
Enum type for specifying access. 
Definition: larod.h:149
bool larodSetJobRequestOutputs(larodJobRequest *jobReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set output tensor array in a job request. 
larodChip
Enum type with supported chips. 
Definition: larod.h:115
void larodDestroyInferenceRequest(larodInferenceRequest **infReq)
Destroy an inference request handle. 
bool larodGetTensorFdProps(const larodTensor *tensor, uint32_t *fdPropFlags, larodError **error)
Get the properties of a file descriptor of a tensor. 
64-bit floating point. 
Definition: larod.h:231
const int64_t * larodMapGetIntArr2(larodMap *map, const char *key, larodError **error)
Get an integer array of two elements tied to given key. 
bool larodRunJobAsync(larodConnection *conn, const larodJobRequest *jobReq, larodRunJobCallback callback, void *userData, larodError **error)
Run a job on a loaded model asynchronously. 
larodAccess larodGetModelAccess(const larodModel *model, larodError **error)
Get model access mode. 
bool larodSetJobRequestModel(larodJobRequest *jobReq, const larodModel *model, larodError **error)
Set model in a request. 
bool larodTrackTensor(larodConnection *conn, larodTensor *tensor, larodError **error)
Start tracking a tensor in the service. 
bool larodRunInferenceAsync(larodConnection *conn, const larodInferenceRequest *infReq, larodRunInferenceCallback callback, void *userData, larodError **error)
Run inference on a loaded model asynchronously. 
struct larodTensor larodTensor
A type representing a tensor. 
Definition: larod.h:447
const larodDevice * larodGetModelDevice(const larodModel *model, larodError **error)
Get device for a model. 
bool larodGetChipId(larodConnection *conn, uint64_t *chipId, larodError **error)
Get current chip ID in use for the session in larod. 
void larodClearError(larodError **error)
Deallocate an error handle. 
bool larodMapSetInt(larodMap *map, const char *key, const int64_t value, larodError **error)
Add an integer to a larodMap object. 
const char * larodGetDeviceName(const larodDevice *dev, larodError **error)
Get the name of a device. 
larodModel * larodGetModel(larodConnection *conn, const uint64_t modelId, larodError **error)
Get handle to a model by model ID. 
struct larodMap larodMap
A type containing key-value pairs. 
Definition: larod.h:458
No layout is specified. 
Definition: larod.h:272
bool larodMapSetStr(larodMap *map, const char *key, const char *value, larodError **error)
Add a string to a larodMap object. 
const char * larodGetModelName(const larodModel *model, larodError **error)
Get model name. 
Error regarding file descriptors. 
Definition: larod.h:180
Invalid layout. 
Definition: larod.h:271
32-bit unsigned integer. 
Definition: larod.h:225
larodInferenceRequest * larodCreateInferenceRequest(const larodModel *model, larodTensor **inputTensors, size_t numInputs, larodTensor **outputTensors, size_t numOutputs, larodError **error)
Create and initialize an inference request handle. 
bool larodDestroyTensors(larodConnection *conn, larodTensor ***tensors, size_t numTensors, larodError **error)
Destroy a list of larodTensor. 
void larodDestroyModel(larodModel **model)
Free an allocated larodModel handle. 
bool larodSetInferenceRequestInputs(larodInferenceRequest *infReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set input tensor array in an inference request. 
Error while deleting model. 
Definition: larod.h:196
Failed killing session. 
Definition: larod.h:190
bool larodSetInferenceRequestOutputs(larodInferenceRequest *infReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set output tensor array in an inference request. 
size_t larodGetModelNumOutputs(const larodModel *model, larodError **error)
Get number of output tensors for a model. 
void larodDestroyModels(larodModel ***models, size_t numModels)
Destroy a list of model objects. 
larodModel * larodLoadModel(larodConnection *conn, const int fd, const larodDevice *dev, const larodAccess access, const char *name, const larodMap *params, larodError **error)
Load a new model. 
bool larodConnect(larodConnection **conn, larodError **error)
Connect to larod. 
void(* larodRunJobCallback)(void *userData, larodError *error)
Callback used in larodRunJobAsync(). 
Definition: larod.h:423
bool larodGetTensorByteSize(const larodTensor *tensor, size_t *byteSize, larodError **error)
Get byte size of tensor. 
Invalid data type. 
Definition: larod.h:218
struct larodConnection larodConnection
Connection handle type for the larod service. 
Definition: larod.h:431
Max enum (dummy value). 
Definition: larod.h:232
bool larodSetTensorFd(larodTensor *tensor, const int fd, larodError **error)
Set file descriptor of a tensor. 
1-bit boolean. 
Definition: larod.h:220
bool larodGetDeviceInstance(const larodDevice *dev, uint32_t *instance, larodError **error)
Get the instance number of a device. 
int64_t larodGetTensorFdOffset(const larodTensor *tensor, larodError **error)
Get file offset for a tensor. 
bool larodGetNumSessions(larodConnection *conn, uint64_t *numSessions, larodError **error)
Get number of currently active sessions in larod. 
bool larodSetTensorPitches(larodTensor *tensor, const larodTensorPitches *pitches, larodError **error)
Set pitches of a tensor. 
No errors. 
Definition: larod.h:168
Model was not found. 
Definition: larod.h:182
bool larodRunJob(larodConnection *conn, const larodJobRequest *jobReq, larodError **error)
Run a job on a loaded model. 
CPU with TensorFlow Lite. 
Definition: larod.h:121
Google TPU. 
Definition: larod.h:123
larodModel ** larodGetModels(larodConnection *conn, size_t *numModels, larodError **error)
Get all loaded models. 
CPU with libyuv. 
Definition: larod.h:134
Could not create session. 
Definition: larod.h:188
void larodDestroyJobRequest(larodJobRequest **jobReq)
Destroy a request handle. 
size_t * larodGetModelInputByteSizes(const larodModel *model, size_t *numInputs, larodError **error)
Get input tensor byte sizes for a model. 
const larodDevice ** larodListDevices(larodConnection *conn, size_t *numDevices, larodError **error)
List available devices. 
larodChip larodGetModelChip(const larodModel *model, larodError **error)
Get chip for a model. 
8-bit signed integer. 
Definition: larod.h:222
Ambarella CVFlow (proc). 
Definition: larod.h:130
Invalid connection. 
Definition: larod.h:186
A type containing information about a tensor's pitches. 
Definition: larod.h:374
No data type is specified. 
Definition: larod.h:219
struct larodJobRequest larodJobRequest
Type describing a job request. 
Definition: larod.h:438
const larodTensorPitches * larodGetTensorPitches(const larodTensor *tensor, larodError **error)
Get pitches of a tensor.