Skip to content

Commit be9977d

Browse files
committed
Add content for Poject Structure and Usage section.
1 parent f754a86 commit be9977d

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed
29 KB
Loading

doc/fluid/design/onnx/onnx_convertor.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,32 @@
66
(@kuke)
77

88
### Project structure
9-
(@pkuyym)
9+
10+
<p align="center">
11+
<img src="./images/project_structure.png"/>
12+
</p>
13+
14+
The project contains four important modules:
15+
16+
* **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.
17+
18+
* **onnx**: ONNX uses proto file to save computation flow and model weights. This module is responsible for parsing and generating ONNX binary model.
19+
20+
* **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.
21+
22+
* **convert.py**: Simple top user interface.
1023

1124
### Usage
12-
(@pkuyym
25+
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.
26+
27+
* fluid inference model to ONNX binary model
28+
29+
`python convert.py --direct fluid2ONNX --whether_do_validation True`
30+
31+
* ONNX binary model to fluid inference model
32+
33+
`python convert.py --direct ONNX2fluid --whether_do_validation True`
34+
1335

1436
### Supported models
1537
(@kuke)

0 commit comments

Comments
 (0)