wonnx icon indicating copy to clipboard operation
wonnx copied to clipboard

Add testing framework to compare against known-good implementations

Open pixelspark opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe.

In order to be able to test correctness of the implementation it would be a good idea to be able to automatically compare it to some other known-good reference point (ideally the ONNX test suites but less ideally some other mature implementation, i.e. https://github.com/sonos/tract for instance).

Describe the solution you'd like

This could simply be a test that runs a set of ONNX models with specific inputs and outputs in WONNX and some other runtime, and then compares the result. I have tested this approach already here: https://github.com/pixelspark/nnx/blob/main/src/main.rs#L126 (and here's how to do inference with tract).

Describe alternatives you've considered

Well, writing tests that check every corner case by reading the spec very carefully :-)

pixelspark avatar Jan 08 '22 21:01 pixelspark

That's a great idea! It will reduce error and devs!

haixuanTao avatar Jan 08 '22 21:01 haixuanTao

@haixuanTao One other interesting thing is that I believe tract can also do the inference of dimensions (we require onnx-simplifier), might want to have a look at how they are doing it!

pixelspark avatar Jan 08 '22 21:01 pixelspark

There is also an 'official' ONNX test harness, which apparently you can plug your own backend in to test it: https://github.com/onnx/onnx/blob/master/docs/ImplementingAnOnnxBackend.md. Probably requires some Python glue code.

pixelspark avatar Jan 08 '22 22:01 pixelspark

Ok, so, I think I'm going to plug to the backend tester with python and put it in the CI :)

haixuanTao avatar Jan 11 '22 10:01 haixuanTao

Just leaving a message here, that I'm working on implementing the onnx backend test suite. But I'm in the middle of a professional move at the moment that is taking a bit of time 😅

I'm going to have more time in February 🙂

haixuanTao avatar Jan 15 '22 22:01 haixuanTao