SSCMA-Micro CPP SDK  v2.0.0
SSCMA-Micro is a cross-platform machine learning inference framework designed for embedded devices.
ma_engine_cvi.h
Go to the documentation of this file.
1 #ifndef _MA_ENGINE_CVI_H_
2 #define _MA_ENGINE_CVI_H_
3 
4 #include <cstddef>
5 #include <cstdint>
6 
7 
8 #include "../ma_common.h"
9 
10 #if MA_USE_ENGINE_CVI
11 
12 #include <cviruntime.h>
13 
14 #include "ma_engine_base.h"
15 
16 
17 namespace ma::engine {
18 
19 class EngineCVI final : public Engine {
20 public:
21  EngineCVI();
22  ~EngineCVI() override;
23 
24  ma_err_t init() override;
25  ma_err_t init(size_t size) override;
26  ma_err_t init(void* pool, size_t size) override;
27 
28  ma_err_t run() override;
29 
30  ma_err_t load(const void* model_data, size_t model_size) override;
31 #if MA_USE_FILESYSTEM
32  ma_err_t load(const char* model_path) override;
33  ma_err_t load(const std::string& model_path) override;
34 #endif
35 
36  int32_t getInputSize() override;
37  int32_t getOutputSize() override;
38  ma_tensor_t getInput(int32_t index) override;
39  ma_tensor_t getOutput(int32_t index) override;
40  ma_shape_t getInputShape(int32_t index) override;
41  ma_shape_t getOutputShape(int32_t index) override;
42  ma_quant_param_t getInputQuantParam(int32_t index) override;
43  ma_quant_param_t getOutputQuantParam(int32_t index) override;
44 
45  ma_err_t setInput(int32_t index, const ma_tensor_t& tensor) override;
46 
47  int32_t getInputNum(const char* name) override;
48  int32_t getOutputNum(const char* name) override;
49 
50 private:
51  CVI_MODEL_HANDLE model;
52  CVI_TENSOR* input_tensors;
53  CVI_TENSOR* output_tensors;
54  int32_t input_num;
55  int32_t output_num;
56 };
57 
58 } // namespace ma
59 
60 #endif
61 
62 #endif // _MA_ENGINE_CVINN_H_
ma_err_t
Definition: ma_types.h:21
Definition: ma_engine_base.h:15
Definition: ma_types.h:44
Definition: ma_types.h:49
Definition: ma_types.h:74