From 8ef6ad3665eb63d074c7c8229678e6b27a31dc34 Mon Sep 17 00:00:00 2001 From: cecilia peng Date: Tue, 20 Dec 2022 17:01:43 +0800 Subject: [PATCH] [Paddle] Add paddle frontend developer guide. (#13464) * Update src/frontends/paddle/README.md Co-authored-by: Tatiana Savina * [Paddle] Add paddle frontend developer guide. * add png. * Update src/frontends/paddle/docs/paddle_frontend_architecture.md Co-authored-by: Ilya Churaev * Update src/frontends/paddle/README.md Co-authored-by: Ilya Churaev * Update src/frontends/paddle/README.md Co-authored-by: Roman Kazantsev * Update src/frontends/paddle/README.md Co-authored-by: Roman Kazantsev * Update src/frontends/paddle/docs/paddle_frontend_architecture.md Co-authored-by: Roman Kazantsev * Update src/frontends/paddle/docs/paddle_frontend_architecture.md Co-authored-by: Roman Kazantsev * Update src/frontends/paddle/docs/tests.md Co-authored-by: Roman Kazantsev * Update src/frontends/paddle/docs/paddle_frontend_architecture.md Co-authored-by: mei, yang * fix CR. * unit test path * Update src/frontends/paddle/docs/paddle_frontend_architecture.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/docs/tests.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/docs/paddle_frontend_architecture.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/README.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/README.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/README.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/README.md Co-authored-by: Tatiana Savina * fix with mermaid. * fix * fix * Update src/frontends/paddle/README.md Co-authored-by: Tatiana Savina * fix * fix * Update src/frontends/paddle/README.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/README.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/docs/tests.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/docs/tests.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/README.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/docs/paddle_frontend_architecture.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/docs/tests.md Co-authored-by: Tatiana Savina * Update src/frontends/paddle/README.md Co-authored-by: Tatiana Savina * more specific * Apply suggestions from code review Co-authored-by: Tatiana Savina Co-authored-by: Tatiana Savina Co-authored-by: Ilya Churaev Co-authored-by: Roman Kazantsev Co-authored-by: mei, yang Co-authored-by: Ilya Churaev --- src/frontends/paddle/README.md | 34 ++++++++++++++++++ .../paddle/docs/operation_mapping_flow.md | 13 +++++++ .../docs/paddle_frontend_architecture.md | 36 +++++++++++++++++++ src/frontends/paddle/docs/tests.md | 17 +++++++++ 4 files changed, 100 insertions(+) create mode 100644 src/frontends/paddle/README.md create mode 100644 src/frontends/paddle/docs/operation_mapping_flow.md create mode 100755 src/frontends/paddle/docs/paddle_frontend_architecture.md create mode 100755 src/frontends/paddle/docs/tests.md diff --git a/src/frontends/paddle/README.md b/src/frontends/paddle/README.md new file mode 100644 index 00000000000..fe8d6ea8e8e --- /dev/null +++ b/src/frontends/paddle/README.md @@ -0,0 +1,34 @@ +# OpenVINO™ Paddle Frontend + +OpenVINO Paddle Frontend is one of the OpenVINO Frontend libraries created for the Baidu PaddlePaddle™ framework. +The component is responsible for: + * Paddle Reader - reads a PaddlePaddle protobuf model and parses it to the frontend InputModel. [Learn more about Paddle Frontend architecture.](./docs/paddle_frontend_architecture.md). + * Paddle Converter - decodes a PaddlePaddle model and operators and maps them semantically to the OpenVINO opset. [Learn more about the operator mapping flow.](./docs/operation_mapping_flow.md). + +OpenVINO Paddle Frontend uses [the common coding style rules](../../../docs/dev/coding_style.md). + +## Key contacts + +People from the [openvino-ie-paddle-maintainers](https://github.com/orgs/openvinotoolkit/teams/openvino-ie-paddle-maintainers) have the rights to approve and merge PRs to the Paddle frontend component. They can assist with any questions about the component. + +## Components + +OpenVINO Paddle Frontend has the following structure: + * [docs](./docs) contains developer documentation for the component. + * [include](./include) contains module API and detailed information about the provided API. + * [src](./src) folder contains sources of the component. + * [tests](./tests) contains tests for the component. To get more information, read [How to run and add tests](./docs/tests.md) page. + +## Debug capabilities + +Developers can use OpenVINO Model debug capabilities that are described in the [OpenVINO Model User Guide](https://docs.openvino.ai/nightly/openvino_docs_OV_UG_Model_Representation.html#model-debug-capabilities). + +## Tutorials + + * [How to support a new operator](./docs/operation_mapping_flow.md) + * [How to run and add tests](./docs/tests.md) + +## See also + * [OpenVINO™ README](../../README.md) + * [OpenVINO Core Components](../README.md) + * [Developer Documentation](../../../docs/dev/index.md) diff --git a/src/frontends/paddle/docs/operation_mapping_flow.md b/src/frontends/paddle/docs/operation_mapping_flow.md new file mode 100644 index 00000000000..ee112f2fe8e --- /dev/null +++ b/src/frontends/paddle/docs/operation_mapping_flow.md @@ -0,0 +1,13 @@ +# OpenVINO Paddle Frontend Operator Enabling Flow + +1. Declare `CreatorFunction` for the Paddle operator and register it to the map in `src/op_table.cpp`. + * The map is retrived from: + + https://github.com/openvinotoolkit/openvino/blob/7d5e0abcaa03703de9918ece2115e6ea652c39e0/src/frontends/paddle/src/op_table.cpp#L106 + +2. Implement the operator mapper `CreatorFunction` in the `src/op/` path. +3. Add unit-tests. For more information, refer to the [OpenVINO™ Paddle Frontend unit-tests readme](tests.md) + +## See also +* [OpenVINO™ Paddle Frontend README](../README.md) +* [OpenVINO™ Frontend README](../../README.md) diff --git a/src/frontends/paddle/docs/paddle_frontend_architecture.md b/src/frontends/paddle/docs/paddle_frontend_architecture.md new file mode 100755 index 00000000000..1fb47cd7dbb --- /dev/null +++ b/src/frontends/paddle/docs/paddle_frontend_architecture.md @@ -0,0 +1,36 @@ +# OpenVINO™ Paddle Frontend Architecture + +The diagram below shows the Paddle Frontend architecture and its interaction with OpenVINO Frontend API and Core APIs. + +```mermaid +flowchart TB + fw_model[(Paddle Model)] + style fw_model fill:#427cb0 + + protobuf([protobuf]) + subgraph frontend [ov::frontend::paddle::FrontEnd] + load_impl["load_impl()"] + end + fw_model--as stream-->load_impl + load_impl--load stream-->protobuf + protobuf--parsed object-->load_impl + + + subgraph input_model [ov::frontend::paddle::InputModel] + convert["convert()"] + end + + load_impl--create-->input_model + + ov_model[ov::Model] + + convert--recursively parse all operations from the model-->ov_model +``` + +* The input to the Paddle Frontend is a PaddlePaddle protobuf model, and the output is the `ov::Model` which is semantically equivalent to the input. +* Paddle Frontend is an implementation of the OpenVINO Frontend, which implements two main interfaces. The first interface is `load`, which reads a Paddle protobuf model and represents it using `InputModel` with `OpPlaces` and `TensorPlaces`. The second interface is `convert`, which represents the `InputModel` with `ov::Model` by semantically mapping these Places to the OpenVINO opset. + + +## See also + * [OpenVINO™ Paddle Frontend README](../README.md) + * [OpenVINO™ Frontend README](../../README.md) diff --git a/src/frontends/paddle/docs/tests.md b/src/frontends/paddle/docs/tests.md new file mode 100755 index 00000000000..df46db55f05 --- /dev/null +++ b/src/frontends/paddle/docs/tests.md @@ -0,0 +1,17 @@ +# OpenVINO Paddle Frontend Tests + +OpenVINO Paddle Frontend [tests](../tests) have the following structure: + * `test_models/gen_scripts/` - Python script to generate PaddlePaddle test models with handy helpers. + * `standalone_build` - PaddlePaddle frontend standalone build test. + * a couple of files - PaddlePaddle frontend operator set unit-test framework and Paddle frontend API unit-test written using Google Test. + +## How to build and run tests + +OpenVINO Paddle Frontend is covered by tests from the binary `paddle_tests`. This binary can be built by the target with the same name. + +## How to add a unit-test +1. Implement python script in `test_models/gen_scripts/` to get the PaddlePaddle test model and the reference inputs and outputs from PaddlePaddle. +2. Register the test case name to `tests/src/op_fuzzy.cpp`, which is part of the operator set unit-test framework. + +## See also + * [OpenVINO™ Paddle Frontend README](../README.md)