diff --git a/doc/fluid/design/onnx/images/project_structure.png b/doc/fluid/design/onnx/images/project_structure.png new file mode 100644 index 0000000000000000000000000000000000000000..ab1c2ff23cfff586516876684348bb15bd2084fc Binary files /dev/null and b/doc/fluid/design/onnx/images/project_structure.png differ diff --git a/doc/fluid/design/onnx/onnx_convertor.md b/doc/fluid/design/onnx/onnx_convertor.md index f3529d796609720c447c691201e2e18c340b0002..c030366e780a4639fdef2b4a394ea4edea45e26c 100644 --- a/doc/fluid/design/onnx/onnx_convertor.md +++ b/doc/fluid/design/onnx/onnx_convertor.md @@ -6,10 +6,32 @@ (@kuke) ### Project structure -(@pkuyym) + +

+ +

+ +The project contains four important modules: + +* **fluid**: Contain wrappers for fluid related APIs. Fluid has provided some low-level APIs to parse or generate the inference model. However, directly using these low-level APIs makes the code tediously long. This module wraps low-level APIs to provide simplied interfaces. + +* **onnx**: ONNX uses proto file to save computation flow and model weights. This module is responsible for parsing and generating ONNX binary model. + +* **onnx_fluid**: Concepts in fluid like program, block etc. haven't direct corresponding concepts in ONNX. Even that both contains operator concept, for many operators adaption is also necessary. This module is the most important module responsible for acutal converting. Adaption for different level concepts should be provided like fluid program/block to ONNX graph, fluid operators to ONNX operators etc. + +* **convert.py**: Simple top user interface. ### Usage -(@pkuyym +The converter is very easy to use. Bi-directional conversion between fluid inference model and ONNX binary model is supported. Model validation is also provided to verify the correctness of converted model. + +* fluid inference model to ONNX binary model + +`python convert.py --direct fluid2ONNX --whether_do_validation True` + +* ONNX binary model to fluid inference model + +`python convert.py --direct ONNX2fluid --whether_do_validation True` + ### Supported models (@kuke)