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

[onnx] Fix loop condition variable #21

Closed beru closed 2 years ago

beru commented 2 years ago

This PR fixes loop condition variable in onnx_graph_alloc function.

When onnx_node_t::init call fails, the function cleans up the nodes. Since the nodes are set up one by one in the outer loop, the inner loop shouldn't erase the nodes that are not yet created to prevent memory access violation.

I tried to use this model and failed. https://github.com/onnx/models/tree/master/vision/object_detection_segmentation/tiny-yolov3