Update ONNX cleaner
Context
ONNX cleaner is a new feature of Aidge whihc aim at cleaning/simplifying ONNX graphs. Multiple recipes have been idenitifed and listed in #83.
This MR aim at adding the basis to then add as many reicpes as possible at once.
For this I worked on two recipes which I see as difficult to stress test my implementation of the cleaner, fuseGelu and fuseLayerNorm.
Once the code base is stable I will add unit test on the existing recipes and merge this.
Detailed major modifications
- Update the way recipes are registered, now using a class to specify the API
- Allow to skip recipes using --skip arg:
onnx_cleaner layernorm_pytorch.onnx t.onnx --skip FuseLayerNorm
- Add fuseGelu recipe
- Add fuseLayerNorm recipe
- Add unit tests that generate ONNX to simplify
- fusegelu
- fuselayernorm
- fuse matmul add
- fuse batchnormalization
- constant shape folding
- remove identity
- onnx cleaner now has irversion and opset arguments
- recipes now depends on an opset level
- Update show_recipes option to increase readbility and show supported opset:
TODO
-
Allow to skip recipes in the CLI see #57 (closed) -
Recipes should depends on opset (for example Layernorm was introduced at opset 17 so no need to use it for opset <17) see: #82 (closed) -
finish fuseLayerNorm for keras -
test all current recipes -
fuse matmul -
remove identity
-
Edited by Cyril Moineau