mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 00:57:33 +08:00
[Backend] Support onnxruntime DirectML inference. (#1304)
* Fix links in readme * Fix links in readme * Update PPOCRv2/v3 examples * Update auto compression configs * Add neww quantization support for paddleclas model * Update quantized Yolov6s model download link * Improve PPOCR comments * Add English doc for quantization * Fix PPOCR rec model bug * Add new paddleseg quantization support * Add new paddleseg quantization support * Add new paddleseg quantization support * Add new paddleseg quantization support * Add Ascend model list * Add ascend model list * Add ascend model list * Add ascend model list * Add ascend model list * Add ascend model list * Add ascend model list * Support DirectML in onnxruntime * Support onnxruntime DirectML * Support onnxruntime DirectML * Support onnxruntime DirectML * Support OnnxRuntime DirectML * Support OnnxRuntime DirectML * Support OnnxRuntime DirectML * Support OnnxRuntime DirectML * Support OnnxRuntime DirectML * Support OnnxRuntime DirectML * Support OnnxRuntime DirectML * Support OnnxRuntime DirectML * Remove DirectML vision model example * Imporve OnnxRuntime DirectML * Imporve OnnxRuntime DirectML * fix opencv cmake in Windows * recheck codestyle
This commit is contained in:
@@ -29,7 +29,8 @@ namespace fastdeploy {
|
||||
/*! Inference backend supported in FastDeploy */
|
||||
enum Backend {
|
||||
UNKNOWN, ///< Unknown inference backend
|
||||
ORT, ///< ONNX Runtime, support Paddle/ONNX format model, CPU / Nvidia GPU
|
||||
ORT, //< ONNX Runtime, support Paddle/ONNX format model,
|
||||
//< CPU/ Nvidia GPU DirectML
|
||||
TRT, ///< TensorRT, support Paddle/ONNX format model, Nvidia GPU only
|
||||
PDINFER, ///< Paddle Inference, support Paddle format model, CPU / Nvidia GPU
|
||||
POROS, ///< Poros, support TorchScript format model, CPU / Nvidia GPU
|
||||
@@ -58,7 +59,8 @@ enum FASTDEPLOY_DECL Device {
|
||||
TIMVX,
|
||||
KUNLUNXIN,
|
||||
ASCEND,
|
||||
SOPHGOTPUD
|
||||
SOPHGOTPUD,
|
||||
DIRECTML
|
||||
};
|
||||
|
||||
/*! Deep learning model format */
|
||||
@@ -93,13 +95,15 @@ static std::map<Device, std::vector<Backend>>
|
||||
{Device::TIMVX, {Backend::LITE}},
|
||||
{Device::KUNLUNXIN, {Backend::LITE}},
|
||||
{Device::ASCEND, {Backend::LITE}},
|
||||
{Device::SOPHGOTPUD, {Backend::SOPHGOTPU}}
|
||||
{Device::SOPHGOTPUD, {Backend::SOPHGOTPU}},
|
||||
{Device::DIRECTML, {Backend::ORT}}
|
||||
};
|
||||
|
||||
inline bool Supported(ModelFormat format, Backend backend) {
|
||||
auto iter = s_default_backends_by_format.find(format);
|
||||
if (iter == s_default_backends_by_format.end()) {
|
||||
FDERROR << "Didn't find format is registered in s_default_backends_by_format." << std::endl;
|
||||
FDERROR << "Didn't find format is registered in " <<
|
||||
"s_default_backends_by_format." << std::endl;
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < iter->second.size(); ++i) {
|
||||
@@ -107,15 +111,17 @@ inline bool Supported(ModelFormat format, Backend backend) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
std::string msg = Str(iter->second);
|
||||
FDERROR << backend << " only supports " << msg << ", but now it's " << format << "." << std::endl;
|
||||
std::string msg = Str(iter->second);
|
||||
FDERROR << backend << " only supports " << msg << ", but now it's "
|
||||
<< format << "." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool Supported(Device device, Backend backend) {
|
||||
auto iter = s_default_backends_by_device.find(device);
|
||||
if (iter == s_default_backends_by_device.end()) {
|
||||
FDERROR << "Didn't find device is registered in s_default_backends_by_device." << std::endl;
|
||||
FDERROR << "Didn't find device is registered in " <<
|
||||
"s_default_backends_by_device." << std::endl;
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < iter->second.size(); ++i) {
|
||||
@@ -123,8 +129,9 @@ inline bool Supported(Device device, Backend backend) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
std::string msg = Str(iter->second);
|
||||
FDERROR << backend << " only supports " << msg << ", but now it's " << device << "." << std::endl;
|
||||
std::string msg = Str(iter->second);
|
||||
FDERROR << backend << " only supports " << msg << ", but now it's "
|
||||
<< device << "." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user