liblarod  @VERSION_STR@
larod.h
Go to the documentation of this file.
1 
11 #ifndef COM_AXIS_LAROD_H
12 #define COM_AXIS_LAROD_H
13 
14 #include <limits.h>
15 #include <stdbool.h>
16 #include <stdint.h>
17 #include <stdlib.h>
18 
19 #include "larod-version.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
28 #define LAROD_TENSOR_MAX_LEN 12
29 
33 #define LAROD_INVALID_MODEL_ID UINT64_MAX
34 
38 #define LAROD_INVALID_FD (INT_MIN)
39 
40 /*
41  * @brief Flags for specifying how one can access a fd of a @c larodTensor.
42  *
43  * As part of @c larodTensor the file descriptor property flags are used to
44  * describe what kind of memory access operations are possible to perform on the
45  * file descriptor of a tensor.
46  *
47  * Upon receiving a @c larodJobRequest the service will inspect the fd
48  * properties of the tensors associated with the request. It will match these
49  * properties with what the @c larodChip associated with the request can handle
50  * in terms of accessing memory. Then with regard to what it has concluded the
51  * service will choose and perform the memory access operations required to
52  * perform the job as efficiently as possible.
53  */
55 #define LAROD_FD_PROP_READWRITE (1UL << 0)
56 #define LAROD_FD_PROP_MAP (1UL << 1)
58 #define LAROD_FD_PROP_DMABUF (1UL << 2)
60 
66 typedef enum {
91 } larodChip;
92 
99 typedef enum {
103 } larodAccess;
104 
116 typedef enum {
121 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
126 #endif
156 
167 typedef enum {
184 
220 typedef enum {
240 
248 typedef struct {
250  const char* msg;
251 } larodError;
252 
270 typedef struct {
271  size_t dims[LAROD_TENSOR_MAX_LEN];
272  size_t len;
274 
324 typedef struct {
325  size_t pitches[LAROD_TENSOR_MAX_LEN];
326  size_t len;
328 
338 typedef struct larodModel larodModel;
339 
356 typedef void (*larodLoadModelCallback)(larodModel* model, void* userData,
357  larodError* error);
358 
373 typedef void (*larodRunJobCallback)(void* userData, larodError* error);
374 
382 
389 
397 typedef struct larodTensor larodTensor;
398 
408 typedef struct larodMap larodMap;
409 
410 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
411 
429 typedef void (*larodRunInferenceCallback)(void* userData, larodError* error);
430 #endif
431 
432 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
433 
443 #endif
444 
455 void larodClearError(larodError** error);
456 
470 bool larodConnect(larodConnection** conn, larodError** error);
471 
488 bool larodDisconnect(larodConnection** conn, larodError** error);
489 
500 bool larodGetNumSessions(larodConnection* conn, uint64_t* numSessions,
501  larodError** error);
502 
513 const char* larodGetChipName(const larodChip chip);
514 
535 bool larodListChips(larodConnection* conn, larodChip** chips, size_t* numChips,
536  larodError** error);
537 
538 #ifdef LAROD_API_VERSION_1
539 larodModel* larodLoadModel_API_VERSION_1(larodConnection* conn, const int fd,
540  const larodAccess access,
541  const char* name, larodError** error);
542 #define larodLoadModel larodLoadModel_API_VERSION_1
543 #else
544 
568 larodModel* larodLoadModel(larodConnection* conn, const int fd,
569  const larodChip chip, const larodAccess access,
570  const char* name, const larodMap* params,
571  larodError** error);
572 #endif
573 
574 #ifdef LAROD_API_VERSION_1
575 bool larodLoadModelAsync_API_VERSION_1(larodConnection* conn, const int fd,
576  const larodAccess access,
577  const char* name,
578  larodLoadModelCallback callback,
579  void* userData, larodError** error);
580 #define larodLoadModelAsync larodLoadModelAsync_API_VERSION_1
581 #else
582 
604 bool larodLoadModelAsync(larodConnection* conn, const int fd,
605  const larodChip chip, const larodAccess access,
606  const char* name, const larodMap* params,
607  larodLoadModelCallback callback, void* userData,
608  larodError** error);
609 #endif
610 
625 larodModel* larodGetModel(larodConnection* conn, const uint64_t modelId,
626  larodError** error);
627 
650 larodModel** larodGetModels(larodConnection* conn, size_t* numModels,
651  larodError** error);
652 
664 void larodDestroyModel(larodModel** model);
665 
677 void larodDestroyModels(larodModel*** models, size_t numModels);
678 
697 bool larodDeleteModel(larodConnection* conn, larodModel* model,
698  larodError** error);
699 
713 uint64_t larodGetModelId(const larodModel* model, larodError** error);
714 
726 larodChip larodGetModelChip(const larodModel* model, larodError** error);
727 
739 size_t larodGetModelSize(const larodModel* model, larodError** error);
740 
753 const char* larodGetModelName(const larodModel* model, larodError** error);
754 
767 
777 size_t larodGetModelNumInputs(const larodModel* model, larodError** error);
778 
788 size_t larodGetModelNumOutputs(const larodModel* model, larodError** error);
789 
806 size_t* larodGetModelInputByteSizes(const larodModel* model, size_t* numInputs,
807  larodError** error);
808 
826 size_t* larodGetModelOutputByteSizes(const larodModel* model,
827  size_t* numOutputs, larodError** error);
828 
859  size_t* numTensors, larodError** error);
860 
891  size_t* numTensors, larodError** error);
892 
939  const larodModel* model,
940  const uint32_t fdPropFlags,
941  size_t* numTensors, larodMap* params,
942  larodError** error);
943 
990  const larodModel* model,
991  const uint32_t fdPropFlags,
992  size_t* numTensors, larodMap* params,
993  larodError** error);
994 
1022 larodTensor** larodCreateTensors(size_t numTensors, larodError** error);
1023 
1036 void larodDestroyTensors(larodTensor*** tensors, size_t numTensors);
1037 
1058 bool larodSetTensorDims(larodTensor* tensor, const larodTensorDims* dims,
1059  larodError** error);
1060 
1075 const larodTensorDims* larodGetTensorDims(const larodTensor* tensor,
1076  larodError** error);
1077 
1094 bool larodSetTensorPitches(larodTensor* tensor,
1095  const larodTensorPitches* pitches,
1096  larodError** error);
1097 
1112  larodError** error);
1113 
1128 bool larodSetTensorDataType(larodTensor* tensor,
1129  const larodTensorDataType dataType,
1130  larodError** error);
1131 
1144  larodError** error);
1145 
1160 bool larodSetTensorLayout(larodTensor* tensor, const larodTensorLayout layout,
1161  larodError** error);
1162 
1175  larodError** error);
1176 
1187 bool larodSetTensorFd(larodTensor* tensor, const int fd, larodError** error);
1188 
1200 int larodGetTensorFd(const larodTensor* tensor, larodError** error);
1201 
1223 bool larodSetTensorFdSize(larodTensor* tensor, const size_t size,
1224  larodError** error);
1225 
1241 bool larodGetTensorFdSize(const larodTensor* tensor, size_t* size,
1242  larodError** error);
1243 
1259 bool larodSetTensorFdOffset(larodTensor* tensor, const int64_t offset,
1260  larodError** error);
1261 
1275 int64_t larodGetTensorFdOffset(const larodTensor* tensor, larodError** error);
1276 
1302 bool larodTrackTensor(larodConnection* conn, larodTensor* tensor,
1303  larodError** error);
1304 
1328 bool larodSetTensorFdProps(larodTensor* tensor, const uint32_t fdPropFlags,
1329  larodError** error);
1330 
1344 bool larodGetTensorFdProps(const larodTensor* tensor, uint32_t* fdPropFlags,
1345  larodError** error);
1346 
1360 const char* larodGetTensorName(const larodTensor* tensor, larodError** error);
1361 
1389 
1398 void larodDestroyMap(larodMap** map);
1399 
1418 bool larodMapSetStr(larodMap* map, const char* key, const char* value,
1419  larodError** error);
1420 
1439 bool larodMapSetInt(larodMap* map, const char* key, const int64_t value,
1440  larodError** error);
1441 
1461 bool larodMapSetIntArr2(larodMap* map, const char* key, const int64_t value0,
1462  const int64_t value1, larodError** error);
1463 
1485 bool larodMapSetIntArr4(larodMap* map, const char* key, const int64_t value0,
1486  const int64_t value1, const int64_t value2,
1487  const int64_t value3, larodError** error);
1488 
1505 const char* larodMapGetStr(larodMap* map, const char* key, larodError** error);
1506 
1525 bool larodMapGetInt(larodMap* map, const char* key, int64_t* value,
1526  larodError** error);
1527 
1544 const int64_t* larodMapGetIntArr2(larodMap* map, const char* key,
1545  larodError** error);
1546 
1563 const int64_t* larodMapGetIntArr4(larodMap* map, const char* key,
1564  larodError** error);
1565 
1596  larodTensor** inputTensors,
1597  size_t numInputs,
1598  larodTensor** outputTensors,
1599  size_t numOutputs, larodMap* params,
1600  larodError** error);
1601 
1612 
1627 bool larodSetJobRequestModel(larodJobRequest* jobReq, const larodModel* model,
1628  larodError** error);
1629 
1644 bool larodSetJobRequestInputs(larodJobRequest* jobReq, larodTensor** tensors,
1645  const size_t numTensors, larodError** error);
1646 
1661 bool larodSetJobRequestOutputs(larodJobRequest* jobReq, larodTensor** tensors,
1662  const size_t numTensors, larodError** error);
1663 
1698 bool larodSetJobRequestPriority(larodJobRequest* jobReq, const uint8_t priority,
1699  larodError** error);
1700 
1716 bool larodSetJobRequestParams(larodJobRequest* jobReq, const larodMap* params,
1717  larodError** error);
1718 
1744 bool larodRunJob(larodConnection* conn, const larodJobRequest* jobReq,
1745  larodError** error);
1746 
1782 bool larodRunJobAsync(larodConnection* conn, const larodJobRequest* jobReq,
1783  larodRunJobCallback callback, void* userData,
1784  larodError** error);
1785 
1786 #ifdef LAROD_DOXYGEN
1787 // The following declaration is only for documentation purposes. Not to be used
1788 // in actual code.
1813 larodModel* larodLoadModel(larodConnection* conn, const int fd,
1814  const larodAccess access, const char* name,
1815  larodError** error);
1816 #endif
1817 
1818 #ifdef LAROD_DOXYGEN
1819 // The following declaration is only for documentation purposes. Not to be used
1820 // in actual code.
1842 bool larodLoadModelAsync(larodConnection* conn, const int fd,
1843  const larodAccess access, const char* name,
1844  larodLoadModelCallback callback, void* userData,
1845  larodError** error);
1846 #endif
1847 
1848 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
1849 
1882  const larodModel* model, larodTensor** inputTensors, size_t numInputs,
1883  larodTensor** outputTensors, size_t numOutputs, larodError** error);
1884 #endif
1885 
1886 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
1887 
1901 #define larodDestroyInferenceRequest larodDestroyJobRequest
1902 #endif
1903 
1904 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
1905 
1925  const larodModel* model, larodError** error);
1926 #define larodSetInferenceRequestModel larodSetJobRequestModel
1927 #endif
1928 
1929 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
1930 
1950  larodTensor** tensors,
1951  const size_t numTensors,
1952  larodError** error);
1953 #define larodSetInferenceRequestInputs larodSetJobRequestInputs
1954 #endif
1955 
1956 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
1957 
1977  larodTensor** tensors,
1978  const size_t numTensors,
1979  larodError** error);
1980 #define larodSetInferenceRequestOutputs larodSetJobRequestOutputs
1981 #endif
1982 
1983 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
1984 
2023  const uint8_t priority,
2024  larodError** error);
2025 #define larodSetInferenceRequestPriority larodSetJobRequestPriority
2026 #endif
2027 
2028 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
2029 
2059  const larodInferenceRequest* infReq, larodError** error);
2060 #define larodRunInference larodRunJob
2061 #endif
2062 
2063 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
2064 
2104  const larodInferenceRequest* infReq,
2105  larodRunInferenceCallback callback, void* userData,
2106  larodError** error);
2107 #define larodRunInferenceAsync larodRunJobAsync
2108 #endif
2109 
2110 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
2111 
2125 bool larodGetChipId(larodConnection* conn, uint64_t* chipId,
2126  larodError** error);
2127 #endif
2128 
2129 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
2130 
2144 bool larodSetChipId(larodConnection* conn, const uint64_t chipId,
2145  larodError** error);
2146 #endif
2147 
2148 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
2149 
2166 bool larodSetChip(larodConnection* conn, const larodChip chip,
2167  larodError** error);
2168 #endif
2169 
2170 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN)
2171 
2185 bool larodGetChipType(larodConnection* conn, larodChip* chipType,
2186  larodError** error);
2187 #endif
2188 
2189 #ifdef __cplusplus
2190 }
2191 #endif
2192 
2193 #endif // COM_AXIS_LAROD_H
larodRunInferenceAsync
bool larodRunInferenceAsync(larodConnection *conn, const larodInferenceRequest *infReq, larodRunInferenceCallback callback, void *userData, larodError **error)
Run inference on a loaded model asynchronously.
larodGetTensorLayout
larodTensorLayout larodGetTensorLayout(const larodTensor *tensor, larodError **error)
Get layout of a tensor.
larodTensor
struct larodTensor larodTensor
A type representing a tensor.
Definition: larod.h:397
larodSetTensorFd
bool larodSetTensorFd(larodTensor *tensor, const int fd, larodError **error)
Set file descriptor of a tensor.
larodMapGetIntArr4
const int64_t * larodMapGetIntArr4(larodMap *map, const char *key, larodError **error)
Get an integer array of four elements tied to given key.
LAROD_TENSOR_DATA_TYPE_UINT64
@ LAROD_TENSOR_DATA_TYPE_UINT64
64-bit unsigned integer.
Definition: larod.h:177
LAROD_TENSOR_DATA_TYPE_MAX
@ LAROD_TENSOR_DATA_TYPE_MAX
Max enum (dummy value).
Definition: larod.h:182
larodGetModel
larodModel * larodGetModel(larodConnection *conn, const uint64_t modelId, larodError **error)
Get handle to a model by model ID.
LAROD_ERROR_ALLOC
@ LAROD_ERROR_ALLOC
Error while allocating.
Definition: larod.h:152
larodDestroyModel
void larodDestroyModel(larodModel **model)
Free an allocated larodModel handle.
larodSetInferenceRequestModel
bool larodSetInferenceRequestModel(larodInferenceRequest *infReq, const larodModel *model, larodError **error)
Set model in an inference request.
larodMapSetInt
bool larodMapSetInt(larodMap *map, const char *key, const int64_t value, larodError **error)
Add an integer to a larodMap object.
larodSetTensorFdProps
bool larodSetTensorFdProps(larodTensor *tensor, const uint32_t fdPropFlags, larodError **error)
Set the properties for a file descriptor of a tensor.
larodAccess
larodAccess
Enum type for specifying access.
Definition: larod.h:99
LAROD_CHIP_INVALID
@ LAROD_CHIP_INVALID
Invalid chip.
Definition: larod.h:68
LAROD_ERROR_CREATE_SESSION
@ LAROD_ERROR_CREATE_SESSION
Could not create session.
Definition: larod.h:138
LAROD_ERROR_INVALID_CHIP_ID
@ LAROD_ERROR_INVALID_CHIP_ID
Invalid chip ID.
Definition: larod.h:142
LAROD_ACCESS_PUBLIC
@ LAROD_ACCESS_PUBLIC
Public access.
Definition: larod.h:102
larodConnect
bool larodConnect(larodConnection **conn, larodError **error)
Connect to larod.
larodJobRequest
struct larodJobRequest larodJobRequest
Type describing a job request.
Definition: larod.h:388
larodDisconnect
bool larodDisconnect(larodConnection **conn, larodError **error)
Disconnect from larod.
LAROD_ERROR_KILL_SESSION
@ LAROD_ERROR_KILL_SESSION
Failed killing session.
Definition: larod.h:140
LAROD_ERROR_TENSOR_MISMATCH
@ LAROD_ERROR_TENSOR_MISMATCH
Tensor mismatch.
Definition: larod.h:148
larodMapSetStr
bool larodMapSetStr(larodMap *map, const char *key, const char *value, larodError **error)
Add a string to a larodMap object.
larodCreateJobRequest
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.
larodDestroyModels
void larodDestroyModels(larodModel ***models, size_t numModels)
Destroy a list of model objects.
LAROD_TENSOR_DATA_TYPE_INVALID
@ LAROD_TENSOR_DATA_TYPE_INVALID
Invalid data type.
Definition: larod.h:168
larodGetTensorDims
const larodTensorDims * larodGetTensorDims(const larodTensor *tensor, larodError **error)
Get dimensions of a tensor.
larodGetModelNumOutputs
size_t larodGetModelNumOutputs(const larodModel *model, larodError **error)
Get number of output tensors for a model.
larodListChips
bool larodListChips(larodConnection *conn, larodChip **chips, size_t *numChips, larodError **error)
List available chips.
larodTensorDims::len
size_t len
Length of dims array.
Definition: larod.h:272
LAROD_CHIP_DEBUG
@ LAROD_CHIP_DEBUG
Dummy chip for debugging.
Definition: larod.h:70
larodMapSetIntArr2
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.
LAROD_TENSOR_DATA_TYPE_INT8
@ LAROD_TENSOR_DATA_TYPE_INT8
8-bit signed integer.
Definition: larod.h:172
larodRunJobCallback
void(* larodRunJobCallback)(void *userData, larodError *error)
Callback used in larodRunJobAsync().
Definition: larod.h:373
LAROD_ERROR_INFERENCE
@ LAROD_ERROR_INFERENCE
Definition: larod.h:125
larodGetModelSize
size_t larodGetModelSize(const larodModel *model, larodError **error)
Get model size.
larodClearError
void larodClearError(larodError **error)
Deallocate an error handle.
LAROD_ERROR_JOB
@ LAROD_ERROR_JOB
General error for job.
Definition: larod.h:120
larodError::code
larodErrorCode code
Error code.
Definition: larod.h:249
larodLoadModel
larodModel * larodLoadModel(larodConnection *conn, const int fd, const larodChip chip, const larodAccess access, const char *name, const larodMap *params, larodError **error)
Load a new model.
LAROD_ERROR_CONNECTION
@ LAROD_ERROR_CONNECTION
Invalid connection.
Definition: larod.h:136
LAROD_ACCESS_PRIVATE
@ LAROD_ACCESS_PRIVATE
Private access.
Definition: larod.h:101
larodDestroyMap
void larodDestroyMap(larodMap **map)
Destroy a larodMap.
larodGetModelId
uint64_t larodGetModelId(const larodModel *model, larodError **error)
Get model ID.
LAROD_CHIP_LIBYUV
@ LAROD_CHIP_LIBYUV
CPU with libyuv.
Definition: larod.h:85
larodGetModels
larodModel ** larodGetModels(larodConnection *conn, size_t *numModels, larodError **error)
Get all loaded models.
larodDestroyInferenceRequest
void larodDestroyInferenceRequest(larodInferenceRequest **infReq)
Destroy an inference request handle.
larodSetTensorPitches
bool larodSetTensorPitches(larodTensor *tensor, const larodTensorPitches *pitches, larodError **error)
Set pitches of a tensor.
LAROD_CHIP_OPENCL
@ LAROD_CHIP_OPENCL
Image processing using OpenCL.
Definition: larod.h:90
larodSetInferenceRequestOutputs
bool larodSetInferenceRequestOutputs(larodInferenceRequest *infReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set output tensor array in an inference request.
larodMapGetIntArr2
const int64_t * larodMapGetIntArr2(larodMap *map, const char *key, larodError **error)
Get an integer array of two elements tied to given key.
LAROD_TENSOR_DATA_TYPE_INT64
@ LAROD_TENSOR_DATA_TYPE_INT64
64-bit signed integer.
Definition: larod.h:178
LAROD_TENSOR_DATA_TYPE_INT32
@ LAROD_TENSOR_DATA_TYPE_INT32
32-bit signed integer.
Definition: larod.h:176
LAROD_CHIP_TPU
@ LAROD_CHIP_TPU
Google TPU.
Definition: larod.h:74
larodCreateModelInputs
larodTensor ** larodCreateModelInputs(const larodModel *model, size_t *numTensors, larodError **error)
Create input tensors from a model.
larodSetTensorFdOffset
bool larodSetTensorFdOffset(larodTensor *tensor, const int64_t offset, larodError **error)
Set file offset for a tensor.
LAROD_ERROR_MODEL_NOT_FOUND
@ LAROD_ERROR_MODEL_NOT_FOUND
Model was not found.
Definition: larod.h:132
LAROD_ERROR_FD
@ LAROD_ERROR_FD
Error regarding file descriptors.
Definition: larod.h:130
larodTensorDims
A type containing information about a tensor's dimensions.
Definition: larod.h:270
LAROD_ERROR_NONE
@ LAROD_ERROR_NONE
No errors.
Definition: larod.h:118
LAROD_TENSOR_LAYOUT_NCHW
@ LAROD_TENSOR_LAYOUT_NCHW
Definition: larod.h:229
larodCreateInferenceRequest
larodInferenceRequest * larodCreateInferenceRequest(const larodModel *model, larodTensor **inputTensors, size_t numInputs, larodTensor **outputTensors, size_t numOutputs, larodError **error)
Create and initialize an inference request handle.
LAROD_TENSOR_DATA_TYPE_INT16
@ LAROD_TENSOR_DATA_TYPE_INT16
16-bit signed integer.
Definition: larod.h:174
larodMap
struct larodMap larodMap
A type containing key-value pairs.
Definition: larod.h:408
larodErrorCode
larodErrorCode
Enum type for error codes.
Definition: larod.h:116
larodAllocModelOutputs
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.
LAROD_TENSOR_DATA_TYPE_FLOAT32
@ LAROD_TENSOR_DATA_TYPE_FLOAT32
32-bit floating point.
Definition: larod.h:180
larodMapGetStr
const char * larodMapGetStr(larodMap *map, const char *key, larodError **error)
Get string type value tied to given key.
larodConnection
struct larodConnection larodConnection
Connection handle type for the larod service.
Definition: larod.h:381
LAROD_CHIP_TFLITE_GLGPU
@ LAROD_CHIP_TFLITE_GLGPU
Definition: larod.h:79
larodError::msg
const char * msg
Error message.
Definition: larod.h:250
larodDestroyTensors
void larodDestroyTensors(larodTensor ***tensors, size_t numTensors)
Destroy a list of larodTensor.
larodSetTensorDims
bool larodSetTensorDims(larodTensor *tensor, const larodTensorDims *dims, larodError **error)
Set the dimensions of a tensor.
larodTensorPitches
A type containing information about a tensor's pitches.
Definition: larod.h:324
larodSetJobRequestOutputs
bool larodSetJobRequestOutputs(larodJobRequest *jobReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set output tensor array in a job request.
larodCreateTensors
larodTensor ** larodCreateTensors(size_t numTensors, larodError **error)
Create a list of empty larodTensor handles.
larodLoadModelAsync
bool larodLoadModelAsync(larodConnection *conn, const int fd, const larodChip chip, const larodAccess access, const char *name, const larodMap *params, larodLoadModelCallback callback, void *userData, larodError **error)
Load a new model asynchronously.
larodSetChip
bool larodSetChip(larodConnection *conn, const larodChip chip, larodError **error)
Set current chip using larodChip in use for the session in larod.
larodDeleteModel
bool larodDeleteModel(larodConnection *conn, larodModel *model, larodError **error)
Delete a loaded model.
LAROD_CHIP_ACE
@ LAROD_CHIP_ACE
Axis Compute Engine.
Definition: larod.h:83
larodRunInference
bool larodRunInference(larodConnection *conn, const larodInferenceRequest *infReq, larodError **error)
Run inference on a loaded model.
LAROD_ERROR_VERSION_MISMATCH
@ LAROD_ERROR_VERSION_MISMATCH
Version mismatch.
Definition: larod.h:150
larodCreateModelOutputs
larodTensor ** larodCreateModelOutputs(const larodModel *model, size_t *numTensors, larodError **error)
Create output tensors from a model.
larodGetTensorName
const char * larodGetTensorName(const larodTensor *tensor, larodError **error)
Get name of tensor.
larodSetJobRequestPriority
bool larodSetJobRequestPriority(larodJobRequest *jobReq, const uint8_t priority, larodError **error)
Set an priority of a job request.
LAROD_ERROR_INVALID_ACCESS
@ LAROD_ERROR_INVALID_ACCESS
Invalid access specifier.
Definition: larod.h:144
larodRunJobAsync
bool larodRunJobAsync(larodConnection *conn, const larodJobRequest *jobReq, larodRunJobCallback callback, void *userData, larodError **error)
Run a job on a loaded model asynchronously.
larodSetTensorLayout
bool larodSetTensorLayout(larodTensor *tensor, const larodTensorLayout layout, larodError **error)
Set layout of a tensor.
larodModel
struct larodModel larodModel
A type representing a model.
Definition: larod.h:338
larodMapSetIntArr4
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.
LAROD_ERROR_PERMISSION
@ LAROD_ERROR_PERMISSION
Insufficient permissions.
Definition: larod.h:134
larodTensorLayout
larodTensorLayout
Enum type for specifying tensor layout.
Definition: larod.h:220
LAROD_TENSOR_DATA_TYPE_UINT16
@ LAROD_TENSOR_DATA_TYPE_UINT16
16-bit unsigned integer.
Definition: larod.h:173
LAROD_ERROR_LOAD_MODEL
@ LAROD_ERROR_LOAD_MODEL
General error for loading model.
Definition: larod.h:128
larodGetModelInputByteSizes
size_t * larodGetModelInputByteSizes(const larodModel *model, size_t *numInputs, larodError **error)
Get input tensor byte sizes for a model.
larodSetTensorDataType
bool larodSetTensorDataType(larodTensor *tensor, const larodTensorDataType dataType, larodError **error)
Set data type of a tensor.
LAROD_TENSOR_DATA_TYPE_UINT8
@ LAROD_TENSOR_DATA_TYPE_UINT8
8-bit unsigned integer.
Definition: larod.h:171
larodGetChipType
bool larodGetChipType(larodConnection *conn, larodChip *chipType, larodError **error)
Get current chip type in use for the session in larod.
larodGetTensorFdOffset
int64_t larodGetTensorFdOffset(const larodTensor *tensor, larodError **error)
Get file offset for a tensor.
larodAllocModelInputs
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.
larodGetTensorFdSize
bool larodGetTensorFdSize(const larodTensor *tensor, size_t *size, larodError **error)
Get file descriptor maximum capacity (bytes) for a tensor.
LAROD_TENSOR_MAX_LEN
#define LAROD_TENSOR_MAX_LEN
Maximum number of dimensions of a larodTensor.
Definition: larod.h:28
LAROD_TENSOR_DATA_TYPE_FLOAT16
@ LAROD_TENSOR_DATA_TYPE_FLOAT16
16-bit floating point.
Definition: larod.h:179
LAROD_TENSOR_LAYOUT_NHWC
@ LAROD_TENSOR_LAYOUT_NHWC
Definition: larod.h:223
larodTensorDataType
larodTensorDataType
Enum type for specifying tensor data type.
Definition: larod.h:167
larodMapGetInt
bool larodMapGetInt(larodMap *map, const char *key, int64_t *value, larodError **error)
Get an integer type value tied to given key.
larodSetInferenceRequestPriority
bool larodSetInferenceRequestPriority(larodInferenceRequest *infReq, const uint8_t priority, larodError **error)
Set an priority of an inference request.
LAROD_TENSOR_DATA_TYPE_UINT32
@ LAROD_TENSOR_DATA_TYPE_UINT32
32-bit unsigned integer.
Definition: larod.h:175
LAROD_CHIP_CVFLOW_PROC
@ LAROD_CHIP_CVFLOW_PROC
Ambarella CVFlow (proc).
Definition: larod.h:81
larodTrackTensor
bool larodTrackTensor(larodConnection *conn, larodTensor *tensor, larodError **error)
Start tracking a tensor in the service.
larodSetJobRequestModel
bool larodSetJobRequestModel(larodJobRequest *jobReq, const larodModel *model, larodError **error)
Set model in a request.
larodChip
larodChip
Enum type with supported chips.
Definition: larod.h:66
LAROD_TENSOR_LAYOUT_INVALID
@ LAROD_TENSOR_LAYOUT_INVALID
Invalid layout.
Definition: larod.h:221
larodCreateMap
larodMap * larodCreateMap(larodError **error)
Create new larodMap.
larodGetTensorFd
int larodGetTensorFd(const larodTensor *tensor, larodError **error)
Get file descriptor of a tensor.
LAROD_TENSOR_DATA_TYPE_UNSPECIFIED
@ LAROD_TENSOR_DATA_TYPE_UNSPECIFIED
No data type is specified.
Definition: larod.h:169
LAROD_TENSOR_LAYOUT_UNSPECIFIED
@ LAROD_TENSOR_LAYOUT_UNSPECIFIED
No layout is specified.
Definition: larod.h:222
LAROD_CHIP_TFLITE_ARTPEC8DLPU
@ LAROD_CHIP_TFLITE_ARTPEC8DLPU
Definition: larod.h:88
larodRunJob
bool larodRunJob(larodConnection *conn, const larodJobRequest *jobReq, larodError **error)
Run a job on a loaded model.
larodGetModelAccess
larodAccess larodGetModelAccess(const larodModel *model, larodError **error)
Get model access mode.
larodGetNumSessions
bool larodGetNumSessions(larodConnection *conn, uint64_t *numSessions, larodError **error)
Get number of currently active sessions in larod.
LAROD_CHIP_CVFLOW_NN
@ LAROD_CHIP_CVFLOW_NN
Ambarella CVFlow (NN).
Definition: larod.h:76
larodDestroyJobRequest
void larodDestroyJobRequest(larodJobRequest **jobReq)
Destroy a request handle.
larodGetModelChip
larodChip larodGetModelChip(const larodModel *model, larodError **error)
Get chip for a model.
larodGetTensorPitches
const larodTensorPitches * larodGetTensorPitches(const larodTensor *tensor, larodError **error)
Get pitches of a tensor.
LAROD_TENSOR_LAYOUT_420SP
@ LAROD_TENSOR_LAYOUT_420SP
Definition: larod.h:236
larodInferenceRequest
struct larodJobRequest larodInferenceRequest
Type describing a job request.
Definition: larod.h:442
larodGetModelNumInputs
size_t larodGetModelNumInputs(const larodModel *model, larodError **error)
Get number of input tensors for a model.
larodGetChipId
bool larodGetChipId(larodConnection *conn, uint64_t *chipId, larodError **error)
Get current chip ID in use for the session in larod.
LAROD_TENSOR_LAYOUT_MAX
@ LAROD_TENSOR_LAYOUT_MAX
Max enum (dummy value).
Definition: larod.h:238
larodGetModelName
const char * larodGetModelName(const larodModel *model, larodError **error)
Get model name.
larodGetTensorFdProps
bool larodGetTensorFdProps(const larodTensor *tensor, uint32_t *fdPropFlags, larodError **error)
Get the properties of a file descriptor of a tensor.
larodSetChipId
bool larodSetChipId(larodConnection *conn, const uint64_t chipId, larodError **error)
Set current chip using ID in use for the session in larod.
LAROD_TENSOR_DATA_TYPE_FLOAT64
@ LAROD_TENSOR_DATA_TYPE_FLOAT64
64-bit floating point.
Definition: larod.h:181
larodSetJobRequestParams
bool larodSetJobRequestParams(larodJobRequest *jobReq, const larodMap *params, larodError **error)
Set additional parameters to a job request.
larodError
Type containing error information.
Definition: larod.h:248
larodRunInferenceCallback
void(* larodRunInferenceCallback)(void *userData, larodError *error)
Callback used in larodRunInferenceAsync().
Definition: larod.h:429
larodTensorPitches::len
size_t len
Length of pitches array.
Definition: larod.h:326
larodGetChipName
const char * larodGetChipName(const larodChip chip)
Get name of a chip.
larodSetInferenceRequestInputs
bool larodSetInferenceRequestInputs(larodInferenceRequest *infReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set input tensor array in an inference request.
LAROD_TENSOR_DATA_TYPE_BOOL
@ LAROD_TENSOR_DATA_TYPE_BOOL
1-bit boolean.
Definition: larod.h:170
larodSetJobRequestInputs
bool larodSetJobRequestInputs(larodJobRequest *jobReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set input tensor array in a request.
larodLoadModelCallback
void(* larodLoadModelCallback)(larodModel *model, void *userData, larodError *error)
Callback used in larodLoadModelAsync().
Definition: larod.h:356
larodSetTensorFdSize
bool larodSetTensorFdSize(larodTensor *tensor, const size_t size, larodError **error)
Set file descriptor maximum capacity (bytes) for a tensor.
LAROD_ACCESS_INVALID
@ LAROD_ACCESS_INVALID
Invalid access.
Definition: larod.h:100
larodGetTensorDataType
larodTensorDataType larodGetTensorDataType(const larodTensor *tensor, larodError **error)
Get data type of a tensor.
LAROD_CHIP_TFLITE_CPU
@ LAROD_CHIP_TFLITE_CPU
CPU with TensorFlow Lite.
Definition: larod.h:72
LAROD_ERROR_MAX_ERRNO
@ LAROD_ERROR_MAX_ERRNO
Max errno value (dummy value).
Definition: larod.h:154
larodGetModelOutputByteSizes
size_t * larodGetModelOutputByteSizes(const larodModel *model, size_t *numOutputs, larodError **error)
Get output tensor byte sizes for a model.
LAROD_ERROR_DELETE_MODEL
@ LAROD_ERROR_DELETE_MODEL
Error while deleting model.
Definition: larod.h:146