Skip to content

Commit 495ecb4

Browse files
Support the onnx string type in output tensors
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.
1 parent d2f1ebe commit 495ecb4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

onnxruntime/tests/integration_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ mod download {
1919
tensor::{DynOrtTensor, OrtOwnedTensor},
2020
GraphOptimizationLevel, LoggingLevel,
2121
};
22+
use onnxruntime::tensor::ndarray_tensor::NdArrayTensor;
2223

2324
#[test]
2425
fn squeezenet_mushroom() {

0 commit comments

Comments
 (0)