Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ONNXRuntime 1.12+ #19

Open
zerovirus123 opened this issue Jan 31, 2023 · 3 comments
Open

Support for ONNXRuntime 1.12+ #19

zerovirus123 opened this issue Jan 31, 2023 · 3 comments

Comments

@zerovirus123
Copy link

Are there any plans to add support for ONNXRuntime 1.12+ (replace session.GetInputName with session.GetInputNameAllocated), replacing const char input and output vectors with ORTAllocatedStringPtr vectors?

@iripatx
Copy link

iripatx commented Mar 23, 2023

I had to store the names as class members, since my network initialization and my inference process are separated in two class methods. While support is not added, here's what I changed to make it work, following this thread:

In header file:

// Inputs
std::vector<Ort::AllocatedStringPtr> inputNodeNameAllocatedStrings;
std::vector<const char*> inputNames;
// Outputs
std::vector<Ort::AllocatedStringPtr> outputNodeNameAllocatedStrings;
std::vector<const char*> outputNames;

In .cpp:

auto input_name = ort_session.GetInputNameAllocated(0, ort_alloc);
inputNodeNameAllocatedStrings.push_back(std::move(input_name));
inputNames.push_back(inputNodeNameAllocatedStrings.back().get());

auto output_name = ort_session.GetOutputNameAllocated(0, ort_alloc);
outputNodeNameAllocatedStrings.push_back(std::move(output_name));
outputNames.push_back(outputNodeNameAllocatedStrings.back().get());

@1ChachA
Copy link

1ChachA commented Nov 27, 2023

Maybe you can even replace:

// inputNames.push_back(session.GetInputName(0, allocator));
// outputNames.push_back(session.GetOutputName(0, allocator));

inputNames.push_back(&*session.GetInputNameAllocated(0, allocator));
outputNames.push_back(&*session.GetOutputNameAllocated(0, allocator));

@junchao98
Copy link

https://github.com/junchao98/yolov5-onnxruntime
I fork and fixed this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants