[WIP] onnx tests
Changes
As we have discussed during roadmap meeting, making kornia not only jittable, but also onnxable would increase kornia usage in production.
This PR is work in progress towards making kornia more production-friendly.
There are several limitations, though, both for our implementation and test
- ONNX does not work for purely functional parts, it crashes with the error
AttributeError: 'function' object has no attribute 'training'
That is why I also created module wrapper around filter2D in this PR
-
Some ways of implementing things would not work. For example, see here https://github.com/kornia/kornia/pull/16373.
-
Right now tests I have added cover only export part, which is necessary, but not sufficient. For example, one can successfully export module, which implements the following operation: 4.
y = (x < 1) * (x > -1)
However, when running onnx.checker.check_model(onnx_model), that would fail, because multiplication operation is not supported for the binary masks. The correct version would be
y = (x < 1) & (x > -1)
However, to test this, we would need to add onnx dependency for our dev setup and also make changes to our CI setup. I think it is a good idea, but let's discuss it first.
Type of change
- [x] 🧪 Tests Cases
@ducha-aiki also related https://github.com/kornia/kornia/issues/1681