[Backend] Remove deprecated ort api (#2034)

* [Backend] Remove deprecated ort api

`Ort::CustomOpApi` deprecated in ONNXRuntime 1.15

fix https://github.com/PaddlePaddle/FastDeploy/issues/2033

* Improve compatibly with ort older than 1.14

* Update fastdeploy/runtime/backends/ort/ops/multiclass_nms.cc

Co-authored-by: Horror Proton <107091537+horror-proton@users.noreply.github.com>

* Fix double free and wrong attrib type in ort/ops

---------

Co-authored-by: Jason <928090362@qq.com>
This commit is contained in:
Horror Proton
2023-06-15 21:35:58 +08:00
committed by GitHub
parent ff631b7838
commit 7191d2da20
4 changed files with 102 additions and 67 deletions

View File

@@ -33,12 +33,12 @@ struct AdaptivePool2dKernel {
protected:
std::string pooling_type_ = "avg";
std::vector<int64_t> output_size_ = {};
Ort::CustomOpApi ort_;
OrtApi ort_;
void* compute_stream_;
const char* provider_;
public:
AdaptivePool2dKernel(Ort::CustomOpApi ort, const OrtKernelInfo* info,
AdaptivePool2dKernel(OrtApi ort, const OrtKernelInfo* info,
const char* provider)
: ort_(ort) {
GetAttribute(info);
@@ -57,7 +57,7 @@ struct AdaptivePool2dKernel {
struct AdaptivePool2dOp
: Ort::CustomOpBase<AdaptivePool2dOp, AdaptivePool2dKernel> {
explicit AdaptivePool2dOp(const char* provider) : provider_(provider) {}
void* CreateKernel(Ort::CustomOpApi api, const OrtKernelInfo* info) const {
void* CreateKernel(OrtApi api, const OrtKernelInfo* info) const {
return new AdaptivePool2dKernel(api, info, provider_);
}