xboot / libonnx

A lightweight, portable pure C99 onnx inference engine for embedded devices with hardware acceleration support.
MIT License
560 stars 101 forks source link

[Constant] use correct argument for onnx_tensor_reinit function #19

Closed beru closed 2 years ago

beru commented 2 years ago

When value_strings attribute is specified in Constant_init function, 3rd argument (dims) of onnx_tensor_reinit is set by the following code.

(int[]){ attr->n_ints }

But I guess attr->n_strings should be used instead of attr->n_ints.


I added the test case node/test_constant_value_strings to make sure value_strings attribute is handled properly. However, the test case passes even with original code because onnx_tensor_reinit function won't be called when output tensor is compatible with specified attribute.