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

Refactor output processing in OnnxInferenceModel prediction methods #465

Merged
merged 6 commits into from
Oct 8, 2022

Conversation

juliabeliaeva
Copy link
Contributor

@juliabeliaeva juliabeliaeva commented Oct 6, 2022

This PR adds:

  1. Function OnnxInferenceModel.predictRaw is introduced to be used for custom output processing and in other prediction methods to remove duplication between them.
  2. Utility functions to extract prediction result without casts from the OrtSession.Result object. There are separate functions for each buffer type, unfortunately did not find a way to implement them without copy-paste.

This allows to get rid of predictRawWithShapes method and replace it with the more customizable alternative. Also we can now pass OrtSession.Result directly to the OnnxHighLevelModel#convert function.

Fixes #358

@juliabeliaeva juliabeliaeva merged commit 4e2e52e into Kotlin:master Oct 8, 2022
@juliabeliaeva juliabeliaeva deleted the onnx-output branch October 8, 2022 12:10
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

Successfully merging this pull request may close these issues.

Refactor OnnxInferenceModel to reduce code duplication
2 participants