mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 00:57:33 +08:00
@@ -66,14 +66,14 @@ class OrtBackend : public BaseBackend {
|
|||||||
const OrtBackendOption& option = OrtBackendOption(),
|
const OrtBackendOption& option = OrtBackendOption(),
|
||||||
bool from_memory_buffer = false);
|
bool from_memory_buffer = false);
|
||||||
|
|
||||||
bool Infer(std::vector<FDTensor>& inputs, std::vector<FDTensor>* outputs);
|
bool Infer(std::vector<FDTensor>& inputs, std::vector<FDTensor>* outputs) override;
|
||||||
|
|
||||||
int NumInputs() const { return inputs_desc_.size(); }
|
int NumInputs() const override { return inputs_desc_.size(); }
|
||||||
|
|
||||||
int NumOutputs() const { return outputs_desc_.size(); }
|
int NumOutputs() const override { return outputs_desc_.size(); }
|
||||||
|
|
||||||
TensorInfo GetInputInfo(int index);
|
TensorInfo GetInputInfo(int index) override;
|
||||||
TensorInfo GetOutputInfo(int index);
|
TensorInfo GetOutputInfo(int index) override;
|
||||||
std::vector<TensorInfo> GetInputInfos() override;
|
std::vector<TensorInfo> GetInputInfos() override;
|
||||||
std::vector<TensorInfo> GetOutputInfos() override;
|
std::vector<TensorInfo> GetOutputInfos() override;
|
||||||
static std::vector<OrtCustomOp*> custom_operators_;
|
static std::vector<OrtCustomOp*> custom_operators_;
|
||||||
|
@@ -67,14 +67,14 @@ class PaddleBackend : public BaseBackend {
|
|||||||
const std::string& model_file, const std::string& params_file,
|
const std::string& model_file, const std::string& params_file,
|
||||||
const PaddleBackendOption& option = PaddleBackendOption());
|
const PaddleBackendOption& option = PaddleBackendOption());
|
||||||
|
|
||||||
bool Infer(std::vector<FDTensor>& inputs, std::vector<FDTensor>* outputs);
|
bool Infer(std::vector<FDTensor>& inputs, std::vector<FDTensor>* outputs) override;
|
||||||
|
|
||||||
int NumInputs() const { return inputs_desc_.size(); }
|
int NumInputs() const override { return inputs_desc_.size(); }
|
||||||
|
|
||||||
int NumOutputs() const { return outputs_desc_.size(); }
|
int NumOutputs() const override { return outputs_desc_.size(); }
|
||||||
|
|
||||||
TensorInfo GetInputInfo(int index);
|
TensorInfo GetInputInfo(int index) override;
|
||||||
TensorInfo GetOutputInfo(int index);
|
TensorInfo GetOutputInfo(int index) override;
|
||||||
std::vector<TensorInfo> GetInputInfos() override;
|
std::vector<TensorInfo> GetInputInfos() override;
|
||||||
std::vector<TensorInfo> GetOutputInfos() override;
|
std::vector<TensorInfo> GetOutputInfos() override;
|
||||||
|
|
||||||
|
@@ -59,6 +59,22 @@ std::string Str(const Device& d) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& out,const Device& d){
|
||||||
|
switch (d) {
|
||||||
|
case Device::CPU:
|
||||||
|
out << "Device::CPU";
|
||||||
|
break;
|
||||||
|
case Device::GPU:
|
||||||
|
out << "Device::GPU";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
out << "Device::UNKOWN";
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string Str(const FDDataType& fdt) {
|
std::string Str(const FDDataType& fdt) {
|
||||||
std::string out;
|
std::string out;
|
||||||
switch (fdt) {
|
switch (fdt) {
|
||||||
@@ -95,6 +111,41 @@ std::string Str(const FDDataType& fdt) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& out,const FDDataType& fdt){
|
||||||
|
switch (fdt) {
|
||||||
|
case FDDataType::BOOL:
|
||||||
|
out << "FDDataType::BOOL";
|
||||||
|
break;
|
||||||
|
case FDDataType::INT16:
|
||||||
|
out << "FDDataType::INT16";
|
||||||
|
break;
|
||||||
|
case FDDataType::INT32:
|
||||||
|
out << "FDDataType::INT32";
|
||||||
|
break;
|
||||||
|
case FDDataType::INT64:
|
||||||
|
out << "FDDataType::INT64";
|
||||||
|
break;
|
||||||
|
case FDDataType::FP32:
|
||||||
|
out << "FDDataType::FP32";
|
||||||
|
break;
|
||||||
|
case FDDataType::FP64:
|
||||||
|
out << "FDDataType::FP64";
|
||||||
|
break;
|
||||||
|
case FDDataType::FP16:
|
||||||
|
out << "FDDataType::FP16";
|
||||||
|
break;
|
||||||
|
case FDDataType::UINT8:
|
||||||
|
out << "FDDataType::UINT8";
|
||||||
|
break;
|
||||||
|
case FDDataType::INT8:
|
||||||
|
out << "FDDataType::INT8";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
out << "FDDataType::UNKNOWN";
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename PlainType>
|
template <typename PlainType>
|
||||||
const FDDataType TypeToDataType<PlainType>::dtype = UNKNOWN1;
|
const FDDataType TypeToDataType<PlainType>::dtype = UNKNOWN1;
|
||||||
|
|
||||||
|
@@ -51,6 +51,10 @@ enum FASTDEPLOY_DECL FDDataType {
|
|||||||
INT8
|
INT8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FASTDEPLOY_DECL std::ostream& operator<<(std::ostream& out,const Device& d);
|
||||||
|
|
||||||
|
FASTDEPLOY_DECL std::ostream& operator<<(std::ostream& out,const FDDataType& fdt);
|
||||||
|
|
||||||
FASTDEPLOY_DECL std::string Str(const FDDataType& fdt);
|
FASTDEPLOY_DECL std::string Str(const FDDataType& fdt);
|
||||||
|
|
||||||
FASTDEPLOY_DECL int32_t FDDataTypeSize(const FDDataType& data_dtype);
|
FASTDEPLOY_DECL int32_t FDDataTypeSize(const FDDataType& data_dtype);
|
||||||
|
Reference in New Issue
Block a user