Skip to content

Commit

Permalink
Support the onnx string type in output tensors
Browse files Browse the repository at this point in the history
This approach allocates owned Strings for each element, which works, but stresses the allocator, and incurs unnecessary copying.

Part of the complication stems from the limitation that in Rust, a field can't be a reference to another field in the same struct. This means that having a Vec<u8> of copied data, referred to by a Vec<&str>, which is then referred to by an ArrayView, requires a sequence of 3 structs to express. Building a Vec<String> gets rid of the references, but also loses the efficiency of 1 allocation with strs pointing into it.
  • Loading branch information
marshallpierce committed Mar 9, 2021
1 parent d2f1ebe commit 495ecb4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions onnxruntime/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mod download {
tensor::{DynOrtTensor, OrtOwnedTensor},
GraphOptimizationLevel, LoggingLevel,
};
use onnxruntime::tensor::ndarray_tensor::NdArrayTensor;

#[test]
fn squeezenet_mushroom() {
Expand Down

0 comments on commit 495ecb4

Please sign in to comment.