16 #include "fastdeploy/runtime/backends/backend.h" 17 #include "fastdeploy/core/fd_tensor.h" 18 #include "bmruntime_interface.h" 19 #include "bmlib_runtime.h" 20 #include "fastdeploy/runtime/backends/sophgo/option.h" 29 class SophgoBackend :
public BaseBackend {
31 SophgoBackend() =
default;
32 virtual ~SophgoBackend();
33 bool Init(
const RuntimeOption& option);
35 int NumInputs()
const override {
36 return static_cast<int>(inputs_desc_.size());
39 int NumOutputs()
const override {
40 return static_cast<int>(outputs_desc_.size());
43 TensorInfo GetInputInfo(
int index)
override;
44 TensorInfo GetOutputInfo(
int index)
override;
45 std::vector<TensorInfo> GetInputInfos()
override;
46 std::vector<TensorInfo> GetOutputInfos()
override;
47 bool Infer(std::vector<FDTensor>& inputs,
48 std::vector<FDTensor>* outputs,
49 bool copy_to_fd =
true)
override;
52 bool LoadModel(
void* model);
53 bool GetSDKAndDeviceVersion();
54 bool GetModelInputOutputInfos();
56 std::vector<TensorInfo> inputs_desc_;
57 std::vector<TensorInfo> outputs_desc_;
58 std::string net_name_;
61 void * p_bmrt_ =
nullptr;
63 bool infer_init =
false;
65 const bm_net_info_t* net_info_ =
nullptr;
69 static FDDataType SophgoTensorTypeToFDDataType(bm_data_type_t type);
70 static bm_data_type_t FDDataTypeToSophgoTensorType(FDDataType type);
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16