mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-08 10:00:29 +08:00
[Other] Refine Paddle Lite backend (#1202)
* Refine Paddle Lite backend * fix error * Fix compile error * Fix build error * modify cpu configure * fix error * Fix comment * Fix error
This commit is contained in:
@@ -19,13 +19,12 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "fastdeploy/runtime/backends/backend.h"
|
||||
#include "fastdeploy/runtime/backends/lite/option.h"
|
||||
#include "paddle_api.h" // NOLINT
|
||||
|
||||
#include "fastdeploy/runtime/backends/backend.h"
|
||||
#include "fastdeploy/runtime/backends/lite/option.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
// Convert data type from paddle lite to fastdeploy
|
||||
FDDataType LiteDataTypeToFD(const paddle::lite_api::PrecisionType& dtype);
|
||||
|
||||
class LiteBackend : public BaseBackend {
|
||||
public:
|
||||
@@ -51,15 +50,26 @@ class LiteBackend : public BaseBackend {
|
||||
std::vector<TensorInfo> GetOutputInfos() override;
|
||||
|
||||
private:
|
||||
void ConfigureCpu(const LiteBackendOption& option);
|
||||
void ConfigureTimvx(const LiteBackendOption& option);
|
||||
void ConfigureAscend(const LiteBackendOption& option);
|
||||
void ConfigureKunlunXin(const LiteBackendOption& option);
|
||||
void ConfigureNNAdapter(const LiteBackendOption& option);
|
||||
|
||||
paddle::lite_api::CxxConfig config_;
|
||||
std::shared_ptr<paddle::lite_api::PaddlePredictor> predictor_;
|
||||
std::vector<TensorInfo> inputs_desc_;
|
||||
std::vector<TensorInfo> outputs_desc_;
|
||||
std::map<std::string, int> inputs_order_;
|
||||
LiteBackendOption option_;
|
||||
bool supported_fp16_ = false;
|
||||
bool ReadFile(const std::string& filename,
|
||||
std::vector<char>* contents,
|
||||
const bool binary = true);
|
||||
};
|
||||
|
||||
// Convert data type from paddle lite to fastdeploy
|
||||
FDDataType LiteDataTypeToFD(const paddle::lite_api::PrecisionType& dtype);
|
||||
|
||||
// Helper function to read file
|
||||
bool ReadFile(const std::string& filename,
|
||||
std::vector<char>* contents,
|
||||
bool binary = true);
|
||||
|
||||
} // namespace fastdeploy
|
||||
|
Reference in New Issue
Block a user