-
Notifications
You must be signed in to change notification settings - Fork 99
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
Add String data type support #58
Add String data type support #58
Conversation
- Tensor construction now uses different logic for primitive types (using their native in-memory layout) and strings (filling the tensor with onnxruntime's `FillStringTensor`). - Extended `TypeToTensorElementDataType` to also be able to expose utf8 contents, if present - `Utf8Data` trait to make it possible to use both `String` and `&str` - `call_ort` helper that takes care of mapping the ort status to a Result so you can't forget to do it - `print_structure` example that shows the inputs and outputs of an .onnx model (names, types, etc)
Strings outputs aren't properly handled, and also even a trivial string model that only applies Tensorflow's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work and sorry for my late reply!
Except from small nitpicks, I wouldn't mind merging this. I would even like to see a small/simple .onnx model committed to test the functionality. Can you create a one that would take a <10s KB?
Thanks!
I'll tidy up this stuff per your comments. I've found that just applying TensorFlow's |
152a0cd
to
f2ed12a
Compare
Awesome! Thanks for this!! 👍 |
FillStringTensor
).TypeToTensorElementDataType
to also be able to expose utf8 contents, if presentUtf8Data
trait to make it possible to use bothString
and&str
call_ort
helper that takes care of mapping the ort status to a Result so you can't forget to do itprint_structure
example that shows the inputs and outputs of an .onnx model (names, types, etc)Without this, interacting with session inputs for a model with a string input would lead to
SIGABRT
as the auto-generated Debug, etc, didn't know what to do with an enum variant of8
(onnxruntime's string type).If this looks good, I'll work on an integration test with a trivial model to ensure that feeding data through actually does work, but I wanted to get feedback on the approach first.