mirror of
https://github.com/opencv/opencv.git
synced 2025-08-01 18:37:04 +08:00
Bump supported ONNX RT version to 1.14.1
- Existing tests pass with the ONNX models mentioned in tests.
This commit is contained in:
parent
9ab0ff6cf2
commit
1d02146810
@ -44,7 +44,8 @@ static std::string pdims(const std::vector<int64_t> &dims) {
|
|||||||
|
|
||||||
struct TensorInfo {
|
struct TensorInfo {
|
||||||
TensorInfo() = default;
|
TensorInfo() = default;
|
||||||
explicit TensorInfo(const Ort::TensorTypeAndShapeInfo& info)
|
|
||||||
|
explicit TensorInfo(const Ort::ConstTensorTypeAndShapeInfo &info)
|
||||||
: dims(info.GetShape())
|
: dims(info.GetShape())
|
||||||
, type(info.GetElementType())
|
, type(info.GetElementType())
|
||||||
, is_dynamic(ade::util::find(dims, -1) != dims.end()) {
|
, is_dynamic(ade::util::find(dims, -1) != dims.end()) {
|
||||||
@ -688,11 +689,10 @@ std::vector<TensorInfo> ONNXCompiled::getTensorInfo(TensorPosition pos) {
|
|||||||
: this_session.GetOutputTypeInfo(i);
|
: this_session.GetOutputTypeInfo(i);
|
||||||
tensor_info.emplace_back(info.GetTensorTypeAndShapeInfo());
|
tensor_info.emplace_back(info.GetTensorTypeAndShapeInfo());
|
||||||
|
|
||||||
char *name_p = pos == INPUT
|
Ort::AllocatedStringPtr name_p = pos == INPUT
|
||||||
? this_session.GetInputName(i, allocator)
|
? this_session.GetInputNameAllocated(i, allocator)
|
||||||
: this_session.GetOutputName(i, allocator);
|
: this_session.GetOutputNameAllocated(i, allocator);
|
||||||
tensor_info.back().name = name_p;
|
tensor_info.back().name = std::string(name_p.get());
|
||||||
allocator.Free(name_p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tensor_info;
|
return tensor_info;
|
||||||
|
@ -332,9 +332,8 @@ public:
|
|||||||
// Inputs Run params
|
// Inputs Run params
|
||||||
std::vector<Ort::Value> in_tensors;
|
std::vector<Ort::Value> in_tensors;
|
||||||
for(size_t i = 0; i < num_in; ++i) {
|
for(size_t i = 0; i < num_in; ++i) {
|
||||||
char* in_node_name_p = session.GetInputName(i, allocator);
|
auto in_node_name_p = session.GetInputNameAllocated(i, allocator);
|
||||||
in_node_names.emplace_back(in_node_name_p);
|
in_node_names.emplace_back(in_node_name_p.get());
|
||||||
allocator.Free(in_node_name_p);
|
|
||||||
in_node_dims = toORT(ins[i].size);
|
in_node_dims = toORT(ins[i].size);
|
||||||
in_tensors.emplace_back(Ort::Value::CreateTensor<T>(memory_info,
|
in_tensors.emplace_back(Ort::Value::CreateTensor<T>(memory_info,
|
||||||
const_cast<T*>(ins[i].ptr<T>()),
|
const_cast<T*>(ins[i].ptr<T>()),
|
||||||
@ -345,9 +344,8 @@ public:
|
|||||||
// Outputs Run params
|
// Outputs Run params
|
||||||
if (custom_out_names.empty()) {
|
if (custom_out_names.empty()) {
|
||||||
for(size_t i = 0; i < num_out; ++i) {
|
for(size_t i = 0; i < num_out; ++i) {
|
||||||
char* out_node_name_p = session.GetOutputName(i, allocator);
|
auto out_node_name_p = session.GetOutputNameAllocated(i, allocator);
|
||||||
out_node_names.emplace_back(out_node_name_p);
|
out_node_names.emplace_back(out_node_name_p.get());
|
||||||
allocator.Free(out_node_name_p);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
out_node_names = std::move(custom_out_names);
|
out_node_names = std::move(custom_out_names);
|
||||||
|
Loading…
Reference in New Issue
Block a user