-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Add design doc for onnx convertor #9296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
f754a86
be9977d
f565e5d
5550bd1
b798e06
56b8784
718f154
4766864
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| ### Backgroud | ||
|
|
||
| (@kuke) | ||
|
|
||
| ### How it works | ||
| (@kuke) | ||
|
|
||
| ### Project structure | ||
|
|
||
| <p align="center"> | ||
| <img src="./images/project_structure.png"/> | ||
| </p> | ||
|
|
||
| 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 | ||
| 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) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generating ONNX binary model. -> generating a ONNX binary model.