Nux C API  0.0.1
C API of NPU Engine
nux.h
Go to the documentation of this file.
1 #ifndef furiosa_libnux_bindings_h
2 #define furiosa_libnux_bindings_h
3 
4 /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
5 
6 #include <stdarg.h>
7 #include <stdbool.h>
8 #include <stdint.h>
9 #include <stdlib.h>
10 
11 typedef enum Axis {
14  /**
15  * For convolution weights, this axis is also known as an input channel.
16  */
18  /**
19  * For convolution weights, this axis is also known as an output channel or feature map.
20  */
29 } Axis;
30 
31 /**
32  * \brief Represent tensor data type
33  */
34 typedef enum TensorDataType {
48 
49 /**
50  * \brief Represent a return status of a function that can fail.
51  */
52 typedef enum nux_error_t {
53  /**
54  * When a function call is successful
55  */
57  /**
58  * When #create_nux fails to initialize
59  */
61  /**
62  * When deploying a model to an executor fails.
63  * See also #nux_create_sync_model, #nux_create_task_model for more details.
64  */
66  /**
67  * When running an inference task fails.
68  * See also #model_run, #task_execute for more details.
69  */
71  /**
72  * When the given index of an input tensor is invalid. See also #model_input_tensor
73  * for more details.
74  */
76  /**
77  * When the given index of an output tensor is invalid. See also #model_output_tensor
78  * for more details.
79  */
81  /**
82  * When a data buffer is invalid. See #tensor_set_buffer for more details.
83  */
85  /**
86  * When the input tensors are invalid
87  */
89  /**
90  * When the output tensors are invalid
91  */
93  /**
94  * When #task_model_get_task or #task_model_try_get_task fails to return an available
95  * task slot. This error code can have different meanings in both functions.
96  * Please see #task_model_get_task and #task_model_try_get_task for more details.
97  */
99  /**
100  * reserved
101  */
103  /**
104  * When waiting for completion queue is timed out
105  */
107  /**
108  * When there's no data in completion queue
109  */
111  /**
112  * When loading a model image fails
113  */
115  /**
116  * When the compiler fails to transform a given model image to a binary for NPU
117  */
119  /**
120  * Internal error
121  */
123  /**
124  * Invalid yaml syntax
125  */
127  /**
128  * incompatible api client error
129  */
131  /**
132  * when api client fails to initialize
133  */
135  /**
136  * No API Key
137  */
139  /**
140  * Null pointer exception
141  */
143  /**
144  * Invalid session option
145  */
147  /**
148  * Session termination
149  */
151  /**
152  * NPU device is busy
153  */
155  /**
156  * Tensor name not found in a given model
157  */
159  /**
160  * Unsupported feature
161  */
163  /**
164  * Npu interrupt
165  */
167  /**
168  * Npu error, TODO, specify all errors in here
169  */
171  /**
172  * When a queue is full
173  */
175  /**
176  * When a queue is empty
177  */
179  /**
180  * When a compiler config is invalid
181  */
184 
185 typedef enum nux_log_level_t {
191 
192 typedef enum profiler_format_t {
196 
197 typedef struct BlockingSession BlockingSession;
198 
200 
201 typedef struct Model Model;
202 
203 typedef struct Nux Nux;
204 
205 typedef struct NuxModel NuxModel;
206 
207 typedef struct OpaqueTensor OpaqueTensor;
208 
209 typedef struct ProfilerGuard ProfilerGuard;
210 
211 typedef struct SessionOptions SessionOptions;
212 
214 
215 typedef struct Task Task;
216 
217 typedef struct TaskModel TaskModel;
218 
219 typedef struct TensorArray TensorArray;
220 
221 typedef struct TensorDesc TensorDesc;
222 
223 /**
224  * \brief Nux handle
225  *
226  * #create_nux initializes an instance of #nux_handle_t.
227  */
228 typedef struct Nux *nux_handle_t;
229 
230 /**
231  * \brief Byte length of a data buffer
232  */
233 typedef uintptr_t nux_buffer_len_t;
234 
235 /**
236  * \brief Handle of a synchronous model
237  *
238  * #nux_create_sync_model initializes an instance of #nux_sync_model_t.
239  */
240 typedef struct Model *nux_sync_model_t;
241 
242 /**
243  * \brief Handle of tensor
244  *
245  * #model_input_tensor or #model_output_tensor returns an instance of #nux_tensor_t.
246  */
247 typedef struct OpaqueTensor *nux_tensor_t;
248 
249 /**
250  * \brief Pointer to a data buffer.
251  *
252  * In Nux, it is commonly used to contain any kind of binary data like ENF binary,
253  * or a data buffer of input/output tensors.
254  */
255 typedef uint8_t *nux_buffer_t;
256 
257 typedef uintptr_t RequestId;
258 
259 /**
260  * \brief Identifier to distinguish tasks in a task model
261  */
263 
264 typedef uint32_t OutputIndex;
265 
266 /**
267  * \brief Index of an output tensor, used in task model
268  */
270 
271 /**
272  * \brief Callback function called per tensor output
273  * when a task of a task model is completed.
274  *
275  * For example, if one model has 2 output tensors,
276  * this function will be called 2 times upon each task's completion.
277  */
279 
280 /**
281  * \brief Callback function called when a task fails to complete.
282  */
284 
285 /**
286  * \brief Callback function which is finally called when a task is completed.
287  *
288  * Unlike #nux_output_callback_t, this callback function is called only once
289  * after #nux_output_callback_t is called for all output tensors.
290  */
292 
293 /**
294  * \brief Handle of a task model
295  *
296  * #nux_create_task_model creates an instance of #nux_task_model_t.
297  */
298 typedef struct TaskModel *nux_task_model_t;
299 
300 /**
301  * \brief Handle of a task of a task model
302  *
303  * #task_model_get_task or #task_model_try_get_task returns an instance of #nux_task_t.
304  */
305 typedef struct Task *nux_task_t;
306 
307 typedef uint32_t InputIndex;
308 
309 /**
310  * \brief Index of an input tensor, used in task model
311  */
313 
314 /**
315  * \brief Session option
316  */
318 
319 /**
320  * \brief Session
321  */
322 typedef const struct BlockingSession *nux_session_t;
323 
324 /**
325  * \brief Model
326  */
327 typedef const struct NuxModel *nux_model_t;
328 
330 
331 /**
332  * \brief Async Session
333  */
335 
337 
338 /**
339  * \brief Context pointer
340  */
341 typedef void *nux_context_t;
342 
343 typedef const struct TensorDesc *nux_tensor_desc_t;
344 
345 /**
346  * \brief A null-terminated C string
347  */
348 typedef char *nux_string_t;
349 
350 /**
351  * \brief Represent a data type of tensor
352  */
354 
355 typedef uint32_t profiler_resource_t;
356 #define profiler_resource_t_CPU (uint32_t)1
357 #define profiler_resource_t_NPU (uint32_t)2
358 
360 
361 typedef Span *profiler_span_t;
362 
363 typedef const Config *npu_config_t;
364 
365 #ifdef __cplusplus
366 extern "C" {
367 #endif // __cplusplus
368 
369 /**
370  * \brief Return a version of Nux native library
371  */
372 const char *version(void);
373 
374 /**
375  * \brief Return a short Git hash of Nux native library
376  */
377 const char *git_short_hash(void);
378 
379 /**
380  * \brief Return a build timestamp of Nux native library
381  */
382 const char *build_timestamp(void);
383 
384 /**
385  * \brief Enable a logger with a specific log level
386  * @param log_level Log level (off, error, warn, info)
387  */
388 void enable_logging(enum nux_log_level_t _log_level);
389 
390 /**
391  * \brief Register Ctrl-C signal handler to exit process.
392  */
394 
395 /**
396  * \brief Creates a new nux handle.
397  *
398  * @param[out] nux Mutable pointer to receive a created Nux handle
399  * @return #nux_error_t_success if successful, or
400  * it will return #nux_error_t_nux_creation_failed.
401  */
403 
404 /**
405  * \brief Destroy the Nux handle and release its resources.
406  *
407  * @param nux Nux handle to be destroyed. It must not be NULL.
408  */
410 
411 /**
412  * \brief Create an instance of a synchronous model.
413  *
414  * It creates a synchronous model to execute a compiled ENF binary.
415  * The synchronous model provides APIs to run a single inference task
416  * with one input batch at a time.
417  *
418  * @param nux Nux handle
419  * @param buffer Byte buffer containing ENF binary
420  * @param len Byte length of `buffer`
421  * @param[out] model Mutable pointer to receive the handle of a created sync model
422  */
424  const uint8_t *buffer,
425  nux_buffer_len_t len,
426  nux_sync_model_t *model);
427 
428 /**
429  * \brief Destroy the sync model and release its resources.
430  *
431  * @param model Sync model to be destroyed, and it must not be NULL.
432  */
434 
435 /**
436  * \brief Return the number of input tensors of a given sync model.
437  *
438  * A model can have more than one input tensor.
439  * This function returns how many input tensors this model has.
440  *
441  * @param model Sync model
442  * @return Output tensors of this model
443  */
445 
446 /**
447  * \brief Return the number of output tensors of a given sync model.
448  *
449  * A model can have more than one output tensor.
450  * This function returns how many output tensors this model has.
451  *
452  * @param model Sync model
453  * @return Output tensors of this model
454  */
456 
457 /**
458  * \brief Get the handle of a specified input tensor from a given sync model.
459  *
460  * \remark An input tensor handle will be valid
461  * until #destroy_sync_model with this `model` is called.
462  *
463  * @param model Sync model
464  * @param index Input tensor index
465  * @param[out] tensor Mutable pointer to receive the handle of a specified input tensor
466  */
467 enum nux_error_t model_input_tensor(nux_sync_model_t model, uint32_t index, nux_tensor_t *tensor);
468 
469 /**
470  * \brief Get the handle of a specified output tensor from a given sync model.
471  *
472  * \remark Output tensor handle will be valid
473  * until #destroy_sync_model with this `model` is called.
474  *
475  * @param model Sync model
476  * @param index Output tensor index
477  * @param[out] tensor Mutable pointer to receive a specified output tensor handle
478  */
479 enum nux_error_t model_output_tensor(nux_sync_model_t model, uint32_t index, nux_tensor_t *tensor);
480 
481 /**
482  * \brief Run a single inference task
483  *
484  * Before calling this function, you must fill input tensors with proper data.
485  * Please refer to #model_input_tensor and #tensor_set_buffer
486  * to learn how to fill input tensors with data.
487  */
489 
490 /**
491  * \brief Get a pointer to the data buffer of a given tensor.
492  *
493  * Once #model_run is called, the inference result will be written into output tensors.
494  * This function returns a pointer to the data buffer of a specified output tensor.
495  *
496  * \remark the buffers of output tensors are valid until #destroy_sync_model is called.
497  *
498  * @param tensor Tensor from which you want to get a pointer of the data buffer
499  * @param[out] buffer Mutable pointer to receive the pointer to the data buffer
500  * @param[out] len Byte length of `buffer`
501  * @return nux_error_t_success if successful
502  */
504 
505 /**
506  * \brief Copy data into the data buffer of a specified input tensor.
507  *
508  * To execute #model_run, you first need to fill input tensors with data.
509  * #tensor_fill_buffer copies the data into the data buffer of a specified input tensor.
510  *
511  * @param tensor Tensor handle into which you want to copy input data
512  * @param buffer Pointer to the data buffer
513  * @param len Byte length of `buffer`
514  * @return nux_error_t_success if successful,
515  * or nux_error_t_invalid_buffer if `buffer` is invalid.
516  */
518 
519 /**
520  * \brief Specify a pointer to a data buffer to a specified input tensor.
521  *
522  * This function is almost same to #tensor_fill_buffer.
523  * However, `tensor` takes the ownership of the buffer with `free` function
524  * to deallocate the buffer. Ensure that nothing else uses the pointer after calling this function.
525  *
526  * if `free` is `null`, `tensor` will not deallocate the buffer.
527  * It can be useful when you want to reuse the buffer or buffer is on a stack area of a function.
528  * Please ensure that the buffer must be deallocated manually by users
529  * in order to prevent the memory leak.
530  *
531  * @param tensor Tensor handle into which you want to copy input data
532  * @param buffer Pointer to the data buffer
533  * @param len Byte length of `buffer`
534  * @param free a function pointer to deallocate a buffer. If `free` is `null`,
535  * `tensor` will not deallocate the data.
536  * @return nux_error_t_success if successful,
537  * or nux_error_t_invalid_buffer if `buffer` is invalid.
538  */
540  nux_buffer_t buffer,
541  nux_buffer_len_t len,
542  void (*free)(uint8_t*, uintptr_t));
543 
544 /**
545  * \brief Create an instance of a task model.
546  *
547  * It allows users to run multiple inference tasks asynchronously and simultaneously.
548  * When each task is completed or failed, corresponding callback functions will be called
549  * with #nux_request_id_t, an identifier of a task request.
550  * See also #task_execute for more details.
551  *
552  * @param nux Nux handle
553  * @param buffer Byte buffer containing ENF binary
554  * @param len Byte length of `buffer`
555  * @param max_batch Number of concurrent running tasks
556  * It can be limited according to internal configurations and HW capacity.
557  * @param output_callback Callback function invoked when a task is completed.
558  * It will be called per output tensor. Please see #nux_output_callback_t for more details.
559  * @param error_callback Callback function invoked when a task is failed.
560  * @param finish_callback Callback function which will be called finally
561  * after the output_callback is called after all output tensors.
562  * @param task_model Mutable pointer to receive the handle of a created task model
563  */
565  const uint8_t *buffer,
566  nux_buffer_len_t len,
567  uint32_t max_batch,
568  nux_output_callback_t output_callback,
569  nux_error_callback_t error_callback,
570  nux_finish_callback_t finish_callback,
571  nux_task_model_t *task_model);
572 
573 /**
574  * \brief Destroy the task model and release its resources.
575  *
576  * @param task_model Task model to be destroyed
577  */
579 
580 /**
581  * \brief Return `true` if there's no running tasks, or `false` if any task is still running.
582  *
583  * @param task_model Task handle
584  */
586 
587 /**
588  * \brief Get a task handle from a specified task model.
589  *
590  * When there's no available task in a given task model,
591  * it will block until new task is available.
592  *
593  * @param task_model Handle of a task model
594  * @param[out] task Mutable pointer to receive the handle of a created task
595  */
597 
598 /**
599  * \brief (non-blocking) Get a task handle from the specified task model.
600  *
601  * It's the non-blocking version of #task_model_get_task.
602  * This function returns an available task, or
603  * it will return immediately #nux_error_t_get_task_failed
604  * if there's no available task in a given task model.
605  *
606  * @param task_model Handle of a task model
607  * @param[out] task Mutable pointer to receive the handle of a created task
608  */
610 
611 /**
612  * \brief Destroy the task and release its resources.
613  *
614  * \remark Once you call #task_execute with a `task`,
615  * the `task` will get destroyed automatically. Please do not call #destroy_task with
616  * the `task` which is already passed to #task_execute.
617  *
618  * @param task Task to be destroyed
619  */
621 
622 /**
623  * \brief Request one asynchronous inference task.
624  *
625  * #task_execute submits a request for an inference task identified by `task`.
626  * Once a task is completed, `output_callback` function passed to #nux_create_task_model
627  * will be called with a distinct output index per output tensor.
628  * `finish_callback` function will be also called
629  * after `output_callback` function is called for all output tensors.
630  *
631  * \remark Once you call #task_execute with a `task`,
632  * the `task` will get destroyed automatically. Please do not call #destroy_task with
633  * the `task` which is already passed to #task_execute.
634  *
635  * @param task Task handle obtained from calling #task_model_get_task
636  * or #task_model_try_get_task.
637  * @param request_id An positive integer to distinguish task requests.
638  * The behavior of #task_execute doesn't rely on a `request_id` value at all.
639  * `request_id` will be just passed to callback functions.
640  * @return #nux_error_t_success if successful.
641  * or #nux_error_t_model_execution_failed if failed.
642  */
643 enum nux_error_t task_execute(nux_task_t task, nux_request_id_t request_id);
644 
645 /**
646  * \brief Return a mutable pointer to the buffer of the specified input tensor.
647  *
648  * @param task Task handle
649  * @param index Index of the input tensor
650  * @return A mutable pointer to the data buffer of the given input tensor
651  */
653 
654 /**
655  * \brief Return the buffer length in bytes of the specified input tensor.
656  *
657  * @param task Task handle
658  * @param index Index of the input tensor
659  */
661 
662 /**
663  * \brief Create a session option
664  *
665  * It allows to specify more options for a session.
666  *
667  * @return Session option
668  */
670 
671 /**
672  * \brief Set a NPU device to the given session option
673  *
674  * If NPU device is not set, Session will use the default NPU device `npu0pe0`.
675  *
676  * @param option Session option
677  * @param devname A NPU device name (e.g., npu0pe0, npu1pe0)
678  */
679 void nux_session_option_set_device(nux_session_option_t builder, const char *devname);
680 
681 /**
682  * \brief Set the number of workers to the given session option
683  *
684  * The number of workers means how many workers handle the inference requests.
685  * By default, the number of workers is 1.
686  *
687  * @param option Session option
688  * @param num The number of workers, and it must be a positive integer.
689  */
691 
692 /**
693  * \brief Set the batch size of input tensors
694  *
695  * The batch size allows to add the dimension of input tensors to feed each inference.
696  *
697  * @param option Session option
698  * @param num Batch size
699  */
701 
702 /**
703  * \brief Set the file path to which the compiler saves log messages.
704  *
705  * @param option Session option
706  * @param path Log path
707  */
709 
710 /**
711  * \brief Enable the compiler hints
712  *
713  * The compilation step prints out the hints of model performances as warning logs if True.
714  *
715  * @param option Session option
716  * @param path Log path
717  */
719 
720 /**
721  * \brief Set the input queue size of async session
722  *
723  * async session has both input and output queues.
724  * The input queue keeps inference requests until the async session handles them.
725  * If it is not set, async session will have the unlimited input queue size by default.
726  * An unlimited input queue will keep the requests as much as your system's memory allow.
727  *
728  * When a input queue length is specified and the queue is full,
729  * the caller of async session will be blocked until async session digests the requests.
730  * It's useful especially when you want backpressure.
731  *
732  * @param option Session option
733  * @param num The input queue size, and it must be > 0 and < 2^31.
734  */
736 
737 /**
738  * \brief Set the output queue size of async session
739  *
740  * async session has both input and output queues.
741  * The output queue keeps inference results until the consumer drains the results.
742  * If it is not set, async session will have the unlimited output queue size by default.
743  * An unlimited output queue will keep the responses as much as your system's memory allow.
744  *
745  * When a output queue length is specified and the queue is full,
746  * async session will be blocked until consumers drain the results.
747  * It's useful especially when you want to prevent the out of memory issue.
748  *
749  * @param option Session option
750  * @param num The output queue size, and it must be be > 0 and < 2^31.
751  */
753 
754 /**
755  * \brief Set a compiler config to the given session option
756  *
757  * If compiler config is not set, Session will use a default compiler config.
758  *
759  * @param option Session option
760  * @param yaml A yaml formatted string of compiler option
761  * @return #nux_error_t_success if successful.
762  * or #nux_error_t_invalid_yaml if `yaml` is not a valid yaml document.
763  */
765 
766 /**
767  * \brief Destroy a session option
768  */
770 
771 /**
772  * \brief Create a session
773  *
774  * Session provides simple and synchronous APIs to run inference tasks from a loaded model.
775  *
776  * @param model_binary Buffer which contains a model binary
777  * @param model_binary_len Length of `model_binary`
778  * @param option Session option. If it is null, the default option will be used.
779  * @param[out] sess Mutable pointer to receive a created Nux handle
780  * @return #nux_error_t_success if successful.
781  * or it will return other error value.
782  */
784  nux_buffer_len_t model_binary_len,
785  nux_session_option_t option,
786  nux_session_t *out_sess);
787 
788 /**
789  * \brief Get the pointer of the Model of a given session
790  *
791  * @param sess Handle of session instance. It must not be `NULL`.
792  * @return Pointer of the Model of a given session
793  */
795 
796 /**
797  * \brief Run an inference task
798  *
799  * @param sess Handle of Session instance. It must not be `NULL`.
800  * @param inputs Input tensors
801  * @param outputs Output tensors
802  * @return #nux_error_t_success if successful.
803  * or it will return other error value.
804  */
806 
807 /**
808  * \brief Run an inference task with tensor names
809  * The number of input/output tensors and its corresponding names must be the same.
810  *
811  * @param sess Handle of Session instance. It must not be `NULL`.
812  * @param input_names An array of input tensor names
813  * @param input_len Number of input tensor names
814  * @param output_names An array of output tensor names
815  * @param output_len Number of output tensor names
816  * @param inputs Input tensors
817  * @param outputs Output tensors
818  * @return #nux_error_t_success if successful.
819  * or it will return other error value.
820  */
822  const char *const *input_names,
823  uintptr_t input_len,
824  const char *const *output_names,
825  uintptr_t output_len,
826  nux_tensor_array_t inputs,
827  nux_tensor_array_t outputs);
828 
829 /**
830  * \brief Destroy a session
831  * @param sess Handle of Session instance to be destroyed. It must not be `NULL`.
832  */
834 
835 /**
836  * \brief Create an asynchronous session and a queue to receive the results.
837  *
838  * #nux_async_session_t allows users to submit inference tasks.
839  * #nux_completion_queue_t is an iterator to receive the result in the asynchronous way.
840  * See also #nux_async_session_run and #nux_completion_queue_next.
841  *
842  * @param model_binary Buffer which contains a model binary
843  * @param model_binary_len Length of `model_binary`
844  * @param option Session option. If it is null, the default option will be used.
845  * @param[out] out_sess Mutable pointer to an instance of async session
846  * @param[out] out_queue Mutable pointer to an instance of async completion queue
847  */
849  nux_buffer_len_t model_binary_len,
850  nux_session_option_t option,
851  nux_async_session_t *out_sess,
852  nux_completion_queue_t *out_queue);
853 
854 /**
855  * \brief Submit an inference task asynchronously. It returns immediately.
856  *
857  * You can receive the completed inference results through #nux_completion_queue_t.
858  * please refer to #nux_completion_queue_next to know how to receive the completed results.
859  *
860  * @param sess Handle of asynchronous session
861  * @param `context` is a void pointer, so you can pass any data to context.
862  * Generally, `context` can be used to identify what's the completion event.
863  * Also, sophisticated data structure can be used to to do more as soon as
864  * you receive the completion event. You must make sure the pointer must be valid as
865  * long as you want to use a passed context even after you receive the completion event.
866  * @param inputs an array of tensors
867  */
869 
870 /**
871  * \brief Wait until it receives any completion event, which can be success or fail.
872  *
873  * @param queue Async completion queue
874  * @param[out] context A pointer of the context value that you passed to `nux_async_session_run`
875  * @param[out] outputs Output tensors
876  * @param[out] error #nux_error_t_success if successful,
877  * #nux_error_t_session_terminated if the async session
878  * is terminated, or it will return other error value.
879  * @return True if async_session is still alive, or False.
880  */
882  nux_context_t *context,
883  nux_tensor_array_t *outputs,
884  enum nux_error_t *error);
885 
886 /**
887  * \brief It's almost the same as #nux_completion_queue_next.
888  * However, this call immediately returns even if it hasn't received any result event
889  * after the last call. In the case, it will set `error` to #nux_error_t_queue_no_data.
890  *
891  * @param queue Async completion queue
892  * @param[out] context A pointer of the context value that you passed to `nux_async_session_run`
893  * @param[out] outputs Output tensors
894  * @param[out] error #nux_error_t_success if successful,
895  * #nux_error_t_session_terminated if the async session
896  * is terminated, #nux_error_t_queue_no_data if no result is received,
897  * or it will return other error value.
898  * @return True if async_session is still alive, or False.
899  */
901  nux_context_t *context,
902  nux_tensor_array_t *outputs,
903  enum nux_error_t *error);
904 
905 /**
906  * \brief It's almost the same as #nux_completion_queue_next.
907  * However, this call will be blocked only until a timeout occurs even if it hasn't received
908  * any result. In this case, it will set #nux_error_t_queue_wait_timeout to `error`.
909  *
910  * @param queue Async completion queue
911  * @param timeout_ms How long to wait before giving up, and its time unit is milliseconds.
912  * @param[out] context A pointer of the context value that you passed to `nux_async_session_run`
913  * @param[out] outputs Output tensors
914  * @param[out] error #nux_error_t_success if successful,
915  * #nux_error_t_session_terminated if the async session
916  * is terminated, #queue_wait_timeout if no data is received until the timeout,
917  * or it will return other error value.
918  * @return True if async_session is still alive, or False.
919  */
921  uint64_t timeout_ms,
922  nux_context_t *context,
923  nux_tensor_array_t *outputs,
924  enum nux_error_t *error);
925 
926 /**
927  * \brief Get the pointer of the Model of a given asynchronous session
928  *
929  * @param sess Handle of asynchronous session instance. It must not be `NULL`.
930  * @return Pointer of the Model of a given asynchronous session
931  */
933 
934 /**
935  * \brief Destroy an asynchronous session
936  */
938 
939 /**
940  * \brief Destroy a completion queue
941  */
943 
944 /**
945  * \brief Return the number of input tensors of the given model
946  */
947 uintptr_t nux_input_num(nux_model_t model);
948 
949 /**
950  * \brief Return the number of output tensors of the given model
951  */
952 uintptr_t nux_output_num(nux_model_t model);
953 
954 /**
955  * \brief Return the description of the tensor matched to the given name
956  * @return the tensor descriptor if there exists Tensor matched to a given name, or null.
957  */
959 
960 /**
961  * \brief Return the description of i-th input tensor of the given model
962  */
964 
965 /**
966  * \brief Return the description of i-th output tensor of the given model
967  */
969 
970 /**
971  * \brief Return the tensor name and transfers its ownership to the caller.
972  * To destroy #nux_string_t, please call #nux_string_destroy.
973  *
974  * @param Tensor descriptor
975  * @return Tensor name if the specific tensor has its name, or null.
976  */
978 
979 /**
980  * \brief Return the number of dimensions of the given tensor
981  */
983 
984 /**
985  * \brief Return the dimension size of the dimension index
986  */
987 uintptr_t nux_tensor_dim(nux_tensor_desc_t tensor, uintptr_t index);
988 
989 /**
990  * \brief Return the stride value of the dimension index
991  */
992 uintptr_t nux_tensor_stride(nux_tensor_desc_t tensor, uintptr_t index);
993 
994 /**
995  * \brief Return the axis type of i-th dimension (e.g., Width, Height, Channel)
996  */
997 enum Axis nux_tensor_axis(nux_tensor_desc_t tensor, uintptr_t idx);
998 
999 /**
1000  * \brief Return the tensor data type
1001  */
1003 
1004 /**
1005  * \brief Return the quantization parameter
1006  *
1007  * Currently only supports per-tensor quantized case.
1008  */
1009 enum nux_error_t nux_tensor_quantization_parameter(nux_tensor_desc_t tensor, double *scale, int32_t *zero_point);
1010 
1011 /**
1012  * \brief Return the total number of all elements
1013  */
1015 
1016 /**
1017  * \brief Return the byte size of tensor
1018  *
1019  * It will be useful when you have to fill the tensor buffer with data.
1020  */
1022 
1023 /**
1024  * \brief Create a tensor according to a given tensor description
1025  *
1026  * You have to call `nux_tensor_destroy` to release the resource of a create tensor.
1027  */
1029 
1030 /**
1031  * \brief Create a tensor with an exiting buffer. It doesn't copy the data.
1032  */
1034  nux_buffer_t buffer,
1035  nux_buffer_len_t len,
1036  void (*free)(uint8_t*, uintptr_t));
1037 
1038 /**
1039  * \brief Destroy a tensor
1040  */
1042 
1043 /**
1044  * \brief Return the pointer to the buffer of this tensor
1045  */
1047 
1048 /**
1049  * \brief Return the size of tensor buffer
1050  */
1052 
1053 /**
1054  * \brief Return an array of tensors corresponding to the names with allocated buffers
1055  */
1056 nux_tensor_array_t nux_tensor_array_allocate_by_names(nux_model_t model, const char *const *names, uintptr_t len);
1057 
1058 /**
1059  * \brief Return an array of tensors corresponding to the names without allocated buffers
1060  */
1061 nux_tensor_array_t nux_tensor_array_create_by_names(nux_model_t model, const char *const *names, uintptr_t len);
1062 
1063 /**
1064  * \brief Return an array of input tensors with allocated buffers
1065  *
1066  * This function is generally used with #tensor_fill_buffer.
1067  */
1069 
1070 /**
1071  * \brief Return an array of input tensors without allocated buffers
1072  *
1073  * This function is generally used with #tensor_set_buffer.
1074  */
1076 
1077 /**
1078  * \brief Return an array of output tensors with allocated buffers
1079  */
1081 
1082 /**
1083  * \brief Return an array of output tensors without allocated buffers
1084  */
1086 
1087 /**
1088  * \brief Return a tensor from the given tensor array
1089  */
1091 
1092 /**
1093  * \brief Return the number of tensors in the given tensor array
1094  */
1096 
1097 /**
1098  * \brief Destroy a tensor array
1099  */
1101 
1102 /**
1103  * \brief Destroy a buffer
1104  * @param buffer Byte buffer to be destroyed. It must not be `NULL`.
1105  * @param len Byte length of `buffer`
1106  */
1107 void nux_buffer_destroy(uint8_t *buf, nux_buffer_len_t len);
1108 
1109 /**
1110  * \brief Destroy a buffer
1111  * @param buffer Byte buffer to be destroyed. It must not be `NULL`.
1112  * @param len Byte length of `buffer`
1113  */
1115 
1116 /**
1117  * \brief Enable a profiler and return the profiler handle.
1118  * @param resource Target resource to be profiled. e.g. CPU or NPU.
1119  * @param format Profiler format. e.g. ChromeTrace.
1120  * @param config Format specific config. You need to pass valid arguments for the format.
1121  * @param[out] profiler A profiler handle.
1122  * @return #nux_error_t_success if successful, or
1123  * or #nux_error_t_invalid_yaml if `config` is not a valid yaml document.
1124  */
1126  enum profiler_format_t format,
1127  const char *config,
1128  profiler_handle_t *profiler);
1129 
1130 /**
1131  * \brief Disable a profiler.
1132  * @param profiler A profiler handle to be disabled.
1133  */
1135 
1136 /**
1137  * \brief Create beginning profiler span with specified name.
1138  * @param record_name Profiler record span name.
1139  * @param warm_up If true, do not record profiler result, and just warm up.
1140  * @return A span handle.
1141  */
1142 profiler_span_t profiler_record_start(const char *record_name, bool _warm_up);
1143 
1144 /**
1145  * \brief Create end profiler span with specified name.
1146  * @param A span handle.
1147  */
1149 
1150 /**
1151  * \brief Get NPU specification by NPUID.
1152  * @param npuid NPUID, indicating a specific NPU configuration with a certain NPU chip.
1153  * Currently, available NPUIDs are WARBOY and WARBOY-2PE.
1154  * @return A reference of the a specific NPU specification.
1155  * The ownership is not transferred to the caller.
1156  */
1157 npu_config_t get_npu_spec(const char *npuid);
1158 
1159 #ifdef __cplusplus
1160 } // extern "C"
1161 #endif // __cplusplus
1162 
1163 #endif /* furiosa_libnux_bindings_h */
void nux_async_session_destroy(nux_async_session_t sess)
Destroy an asynchronous session.
void register_signal_handler(void)
Register Ctrl-C signal handler to exit process.
enum nux_error_t nux_create_task_model(nux_handle_t nux, const uint8_t *buffer, nux_buffer_len_t len, uint32_t max_batch, nux_output_callback_t output_callback, nux_error_callback_t error_callback, nux_finish_callback_t finish_callback, nux_task_model_t *task_model)
Create an instance of a task model.
nux_tensor_array_t nux_tensor_array_create_inputs(nux_model_t model)
Return an array of input tensors without allocated buffers.
enum nux_error_t nux_create_sync_model(nux_handle_t nux, const uint8_t *buffer, nux_buffer_len_t len, nux_sync_model_t *model)
Create an instance of a synchronous model.
uint32_t InputIndex
Definition: nux.h:307
void destroy_sync_model(nux_sync_model_t model)
Destroy the sync model and release its resources.
nux_tensor_array_t nux_tensor_array_allocate_outputs(nux_model_t model)
Return an array of output tensors with allocated buffers.
nux_tensor_array_t nux_tensor_array_create_by_names(nux_model_t model, const char *const *names, uintptr_t len)
Return an array of tensors corresponding to the names without allocated buffers.
void nux_session_option_set_input_queue_size(nux_session_option_t builder, uintptr_t len)
Set the input queue size of async session.
uintptr_t nux_tensor_size(nux_tensor_desc_t tensor)
Return the byte size of tensor.
struct Task Task
Definition: nux.h:215
enum nux_error_t nux_tensor_quantization_parameter(nux_tensor_desc_t tensor, double *scale, int32_t *zero_point)
Return the quantization parameter.
struct CompletionQueue_ContextPtr * nux_completion_queue_t
Definition: nux.h:336
void(* nux_error_callback_t)(nux_request_id_t, enum nux_error_t)
Callback function called when a task fails to complete.
Definition: nux.h:283
nux_tensor_desc_t nux_output_desc(nux_model_t model, uintptr_t index)
Return the description of i-th output tensor of the given model.
struct Model * nux_sync_model_t
Handle of a synchronous model.
Definition: nux.h:240
enum nux_error_t task_model_get_task(nux_task_model_t task_model, nux_task_t *task)
Get a task handle from a specified task model.
OutputIndex nux_output_index_t
Index of an output tensor, used in task model.
Definition: nux.h:269
struct TaskModel * nux_task_model_t
Handle of a task model.
Definition: nux.h:298
struct Submitter_ContextPtr * nux_async_session_t
Async Session.
Definition: nux.h:334
struct TensorArray * nux_tensor_array_t
Definition: nux.h:329
enum nux_error_t tensor_set_buffer(nux_tensor_t tensor, nux_buffer_t buffer, nux_buffer_len_t len, void(*free)(uint8_t *, uintptr_t))
Specify a pointer to a data buffer to a specified input tensor.
void nux_session_option_destroy(nux_session_option_t option)
Destroy a session option.
TensorDataType
Represent tensor data type.
Definition: nux.h:34
@ tensor_data_type_int4
Definition: nux.h:42
@ tensor_data_type_int64
Definition: nux.h:39
@ tensor_data_type_int16
Definition: nux.h:45
@ tensor_data_type_bool
Definition: nux.h:41
@ tensor_data_type_float8_e4m3
Definition: nux.h:44
@ tensor_data_type_float32
Definition: nux.h:35
@ tensor_data_type_int8
Definition: nux.h:37
@ tensor_data_type_bfloat16
Definition: nux.h:40
@ tensor_data_type_uint8
Definition: nux.h:36
@ tensor_data_type_float8_e5m2
Definition: nux.h:43
@ tensor_data_type_float16
Definition: nux.h:46
@ tensor_data_type_int32
Definition: nux.h:38
struct OpaqueTensor OpaqueTensor
Definition: nux.h:207
nux_tensor_t nux_tensor_array_get(nux_tensor_array_t array, uintptr_t index)
Return a tensor from the given tensor array.
struct NuxModel NuxModel
Definition: nux.h:205
enum nux_error_t nux_session_run(nux_session_t sess, nux_tensor_array_t inputs, nux_tensor_array_t outputs)
Run an inference task.
void(* nux_output_callback_t)(nux_request_id_t, nux_output_index_t, nux_buffer_t, nux_buffer_len_t)
Callback function called per tensor output when a task of a task model is completed.
Definition: nux.h:278
bool task_model_is_all_task_done(nux_task_model_t task_model)
Return true if there's no running tasks, or false if any task is still running.
nux_tensor_desc_t nux_input_desc(nux_model_t model, uintptr_t index)
Return the description of i-th input tensor of the given model.
void enable_logging(enum nux_log_level_t _log_level)
Enable a logger with a specific log level.
uintptr_t nux_tensor_array_len(nux_tensor_array_t array)
Return the number of tensors in the given tensor array.
nux_tensor_t nux_tensor_create(nux_tensor_desc_t desc)
Create a tensor according to a given tensor description.
void nux_tensor_array_destroy(nux_tensor_array_t array)
Destroy a tensor array.
uintptr_t nux_tensor_dim_num(nux_tensor_desc_t tensor)
Return the number of dimensions of the given tensor.
Span * profiler_span_t
Definition: nux.h:361
struct ProfilerGuard * profiler_handle_t
Definition: nux.h:359
void nux_session_option_set_device(nux_session_option_t builder, const char *devname)
Set a NPU device to the given session option.
nux_buffer_len_t task_input_size(nux_task_t task, nux_input_index_t index)
Return the buffer length in bytes of the specified input tensor.
nux_error_t
Represent a return status of a function that can fail.
Definition: nux.h:52
@ nux_error_t_session_terminated
Definition: nux.h:150
@ nux_error_t_queue_no_data
Definition: nux.h:110
@ nux_error_t_npu_interrupt
Definition: nux.h:166
@ nux_error_t_invalid_outputs
Definition: nux.h:92
@ nux_error_t_model_deploy_failed
Definition: nux.h:65
@ nux_error_t_queue_full
Definition: nux.h:174
@ nux_error_t_invalid_session_options
Definition: nux.h:146
@ nux_error_t_tensor_name_not_found
Definition: nux.h:158
@ nux_error_t_unsupported_feature
Definition: nux.h:162
@ nux_error_t_invalid_yaml
Definition: nux.h:126
@ nux_error_t_invalid_output_index
Definition: nux.h:80
@ nux_error_t_invalid_inputs
Definition: nux.h:88
@ nux_error_t_dump_profile_failed
Definition: nux.h:102
@ nux_error_t_no_api_key
Definition: nux.h:138
@ nux_error_t_npu_error
Definition: nux.h:170
@ nux_error_t_invalid_compiler_config
Definition: nux.h:182
@ nux_error_t_queue_wait_timeout
Definition: nux.h:106
@ nux_error_t_null_pointer_exception
Definition: nux.h:142
@ nux_error_t_device_busy
Definition: nux.h:154
@ nux_error_t_get_task_failed
Definition: nux.h:98
@ nux_error_t_incompatible_model
Definition: nux.h:114
@ nux_error_t_success
Definition: nux.h:56
@ nux_error_t_compilation_failed
Definition: nux.h:118
@ nux_error_t_api_client_init_failed
Definition: nux.h:134
@ nux_error_t_queue_empty
Definition: nux.h:178
@ nux_error_t_incompatible_api_client_error
Definition: nux.h:130
@ nux_error_t_model_execution_failed
Definition: nux.h:70
@ nux_error_t_invalid_buffer
Definition: nux.h:84
@ nux_error_t_invalid_input_index
Definition: nux.h:75
@ nux_error_t_nux_creation_failed
Definition: nux.h:60
@ nux_error_t_internal_error
Definition: nux.h:122
nux_log_level_t
Definition: nux.h:185
@ nux_log_level_t_warn
Definition: nux.h:188
@ nux_log_level_t_off
Definition: nux.h:186
@ nux_log_level_t_info
Definition: nux.h:189
@ nux_log_level_t_error
Definition: nux.h:187
profiler_format_t
Definition: nux.h:192
@ profiler_format_t_chrome_trace
Definition: nux.h:193
@ profiler_format_t_csv_trace
Definition: nux.h:194
void nux_string_destroy(nux_string_t str)
Destroy a buffer.
enum nux_error_t profiler_enable(profiler_resource_t resource, enum profiler_format_t format, const char *config, profiler_handle_t *profiler)
Enable a profiler and return the profiler handle.
enum nux_error_t nux_async_session_create(nux_buffer_t model_binary, nux_buffer_len_t model_binary_len, nux_session_option_t option, nux_async_session_t *out_sess, nux_completion_queue_t *out_queue)
Create an asynchronous session and a queue to receive the results.
nux_tensor_array_t nux_tensor_array_allocate_by_names(nux_model_t model, const char *const *names, uintptr_t len)
Return an array of tensors corresponding to the names with allocated buffers.
nux_model_t nux_session_get_model(nux_session_t sess)
Get the pointer of the Model of a given session.
uintptr_t nux_tensor_len(nux_tensor_desc_t tensor)
Return the total number of all elements.
void destroy_task_model(nux_task_model_t task_model)
Destroy the task model and release its resources.
void nux_session_option_set_compiler_log_path(nux_session_option_t builder, const char *path)
Set the file path to which the compiler saves log messages.
uintptr_t nux_input_num(nux_model_t model)
Return the number of input tensors of the given model.
nux_tensor_array_t nux_tensor_array_allocate_inputs(nux_model_t model)
Return an array of input tensors with allocated buffers.
npu_config_t get_npu_spec(const char *npuid)
Get NPU specification by NPUID.
enum nux_error_t task_model_try_get_task(nux_task_model_t task_model, nux_task_t *task)
(non-blocking) Get a task handle from the specified task model.
InputIndex nux_input_index_t
Index of an input tensor, used in task model.
Definition: nux.h:312
uintptr_t RequestId
Definition: nux.h:257
enum nux_error_t model_input_tensor(nux_sync_model_t model, uint32_t index, nux_tensor_t *tensor)
Get the handle of a specified input tensor from a given sync model.
const char * build_timestamp(void)
Return a build timestamp of Nux native library.
uint32_t OutputIndex
Definition: nux.h:264
RequestId nux_request_id_t
Identifier to distinguish tasks in a task model.
Definition: nux.h:262
void nux_tensor_destroy(nux_tensor_t tensor)
Destroy a tensor.
uint32_t profiler_resource_t
Definition: nux.h:355
void destroy_task(nux_task_t task)
Destroy the task and release its resources.
enum Axis nux_tensor_axis(nux_tensor_desc_t tensor, uintptr_t idx)
Return the axis type of i-th dimension (e.g., Width, Height, Channel)
struct Nux * nux_handle_t
Nux handle.
Definition: nux.h:228
struct TaskModel TaskModel
Definition: nux.h:217
void nux_session_option_set_worker_num(nux_session_option_t builder, uintptr_t num)
Set the number of workers to the given session option.
enum nux_error_t nux_async_session_run(nux_async_session_t sess, nux_context_t context, nux_tensor_array_t inputs)
Submit an inference task asynchronously. It returns immediately.
nux_tensor_array_t nux_tensor_array_create_outputs(nux_model_t model)
Return an array of output tensors without allocated buffers.
struct OpaqueTensor * nux_tensor_t
Handle of tensor.
Definition: nux.h:247
enum nux_error_t nux_session_create(nux_buffer_t model_binary, nux_buffer_len_t model_binary_len, nux_session_option_t option, nux_session_t *out_sess)
Create a session.
bool nux_completion_queue_try_next(nux_completion_queue_t queue, nux_context_t *context, nux_tensor_array_t *outputs, enum nux_error_t *error)
It's almost the same as nux_completion_queue_next. However, this call immediately returns even if it ...
const struct TensorDesc * nux_tensor_desc_t
Definition: nux.h:343
enum TensorDataType nux_tensor_dtype_t
Represent a data type of tensor.
Definition: nux.h:353
struct Nux Nux
Definition: nux.h:203
nux_tensor_t nux_tensor_create_with_buffer(nux_tensor_desc_t desc, nux_buffer_t buffer, nux_buffer_len_t len, void(*free)(uint8_t *, uintptr_t))
Create a tensor with an exiting buffer. It doesn't copy the data.
uint32_t model_count_outputs(nux_sync_model_t model)
Return the number of output tensors of a given sync model.
nux_tensor_desc_t nux_tensor_desc_by_name(nux_model_t model, const char *name)
Return the description of the tensor matched to the given name.
const char * git_short_hash(void)
Return a short Git hash of Nux native library.
uintptr_t nux_tensor_buffer_size(nux_tensor_t tensor)
Return the size of tensor buffer.
nux_buffer_t task_input(nux_task_t task, nux_input_index_t index)
Return a mutable pointer to the buffer of the specified input tensor.
nux_model_t nux_async_session_get_model(nux_async_session_t sess)
Get the pointer of the Model of a given asynchronous session.
void nux_buffer_destroy(uint8_t *buf, nux_buffer_len_t len)
Destroy a buffer.
bool nux_completion_queue_next(nux_completion_queue_t queue, nux_context_t *context, nux_tensor_array_t *outputs, enum nux_error_t *error)
Wait until it receives any completion event, which can be success or fail.
struct Model Model
Definition: nux.h:201
struct CompletionQueue_ContextPtr CompletionQueue_ContextPtr
Definition: nux.h:199
nux_session_option_t nux_session_option_create(void)
Create a session option.
void nux_session_option_set_batch_size(nux_session_option_t builder, uintptr_t num)
Set the batch size of input tensors.
uint32_t model_count_inputs(nux_sync_model_t model)
Return the number of input tensors of a given sync model.
enum nux_error_t tensor_get_buffer(nux_tensor_t tensor, nux_buffer_t *buffer, nux_buffer_len_t *len)
Get a pointer to the data buffer of a given tensor.
void nux_session_option_enable_compiler_hints(nux_session_option_t builder, bool enable)
Enable the compiler hints.
void(* nux_finish_callback_t)(nux_request_id_t)
Callback function which is finally called when a task is completed.
Definition: nux.h:291
struct Submitter_ContextPtr Submitter_ContextPtr
Definition: nux.h:213
char * nux_string_t
A null-terminated C string.
Definition: nux.h:348
enum nux_error_t tensor_fill_buffer(nux_tensor_t tensor, nux_buffer_t buffer, nux_buffer_len_t len)
Copy data into the data buffer of a specified input tensor.
struct Task * nux_task_t
Handle of a task of a task model.
Definition: nux.h:305
const struct BlockingSession * nux_session_t
Session.
Definition: nux.h:322
enum nux_error_t nux_session_option_set_compiler_config(nux_session_option_t option, const char *yaml)
Set a compiler config to the given session option.
struct SessionOptions * nux_session_option_t
Session option.
Definition: nux.h:317
nux_tensor_dtype_t nux_tensor_dtype(nux_tensor_desc_t tensor)
Return the tensor data type.
uint8_t * nux_tensor_buffer(nux_tensor_t tensor)
Return the pointer to the buffer of this tensor.
uintptr_t nux_output_num(nux_model_t model)
Return the number of output tensors of the given model.
void profiler_disable(profiler_handle_t profiler)
Disable a profiler.
profiler_span_t profiler_record_start(const char *record_name, bool _warm_up)
Create beginning profiler span with specified name.
void nux_session_option_set_output_queue_size(nux_session_option_t builder, uintptr_t len)
Set the output queue size of async session.
struct BlockingSession BlockingSession
Definition: nux.h:197
void nux_session_destroy(nux_session_t sess)
Destroy a session.
Axis
Definition: nux.h:11
@ axis_batch
Definition: nux.h:21
@ axis_channel
Definition: nux.h:17
@ axis_unknown
Definition: nux.h:26
@ axis_group
Definition: nux.h:27
@ axis_width_outer
Definition: nux.h:22
@ axis_width
Definition: nux.h:12
@ axis_height_outer
Definition: nux.h:23
@ axis_batch_outer
Definition: nux.h:25
@ axis_group_outer
Definition: nux.h:28
@ axis_height
Definition: nux.h:13
@ axis_channel_outer
Definition: nux.h:24
bool nux_completion_queue_next_timeout(nux_completion_queue_t queue, uint64_t timeout_ms, nux_context_t *context, nux_tensor_array_t *outputs, enum nux_error_t *error)
It's almost the same as nux_completion_queue_next. However, this call will be blocked only until a ti...
void nux_completion_queue_destroy(nux_completion_queue_t queue)
Destroy a completion queue.
enum nux_error_t create_nux(nux_handle_t *nux)
Creates a new nux handle.
void profiler_record_end(profiler_span_t span)
Create end profiler span with specified name.
const char * version(void)
Return a version of Nux native library.
enum nux_error_t model_run(nux_sync_model_t model)
Run a single inference task.
uintptr_t nux_buffer_len_t
Byte length of a data buffer.
Definition: nux.h:233
enum nux_error_t nux_session_run_with(nux_session_t sess, const char *const *input_names, uintptr_t input_len, const char *const *output_names, uintptr_t output_len, nux_tensor_array_t inputs, nux_tensor_array_t outputs)
Run an inference task with tensor names The number of input/output tensors and its corresponding name...
struct ProfilerGuard ProfilerGuard
Definition: nux.h:209
const Config * npu_config_t
Definition: nux.h:363
struct SessionOptions SessionOptions
Definition: nux.h:211
uintptr_t nux_tensor_dim(nux_tensor_desc_t tensor, uintptr_t index)
Return the dimension size of the dimension index.
struct TensorDesc TensorDesc
Definition: nux.h:221
void * nux_context_t
Context pointer.
Definition: nux.h:341
uintptr_t nux_tensor_stride(nux_tensor_desc_t tensor, uintptr_t index)
Return the stride value of the dimension index.
nux_string_t nux_tensor_name(nux_tensor_desc_t tensor)
Return the tensor name and transfers its ownership to the caller. To destroy nux_string_t,...
uint8_t * nux_buffer_t
Pointer to a data buffer.
Definition: nux.h:255
void destroy_nux(nux_handle_t nux)
Destroy the Nux handle and release its resources.
enum nux_error_t model_output_tensor(nux_sync_model_t model, uint32_t index, nux_tensor_t *tensor)
Get the handle of a specified output tensor from a given sync model.
enum nux_error_t task_execute(nux_task_t task, nux_request_id_t request_id)
Request one asynchronous inference task.
struct TensorArray TensorArray
Definition: nux.h:219
const struct NuxModel * nux_model_t
Model.
Definition: nux.h:327