From af874e7754db24034948994bf3599925cf3de0d9 Mon Sep 17 00:00:00 2001 From: Yuan Hu Date: Wed, 23 Mar 2022 16:31:03 +0800 Subject: [PATCH] update AUTO Debug doc with snippets (#11117) Signed-off-by: Hu, Yuan2 --- .../supported_plugins/AutoPlugin_Debugging.md | 38 +++++-------------- docs/snippets/AUTO6.cpp | 4 +- docs/snippets/ov_auto.py | 13 +++++++ 3 files changed, 24 insertions(+), 31 deletions(-) diff --git a/docs/OV_Runtime_UG/supported_plugins/AutoPlugin_Debugging.md b/docs/OV_Runtime_UG/supported_plugins/AutoPlugin_Debugging.md index b0c38920e55..a2546b01e56 100644 --- a/docs/OV_Runtime_UG/supported_plugins/AutoPlugin_Debugging.md +++ b/docs/OV_Runtime_UG/supported_plugins/AutoPlugin_Debugging.md @@ -13,38 +13,18 @@ There are six levels of logs, which can be called explicitly or set via the `OPE 5 - ov::log::Level::TRACE @sphinxdirective -.. tab:: C++ API - .. code-block:: cpp +.. tab:: C++ - ov::Core core; + .. doxygensnippet:: docs/snippets/AUTO6.cpp + :language: cpp + :fragment: [part6] + +.. tab:: Python - // read a network in IR, PaddlePaddle, or ONNX format - std::shared_ptr model = core.read_model("sample.xml"); - - // load a network to AUTO and set log level to debug - ov::CompiledModel compiled_model = core.compile_model(model, "AUTO", {{ov::log::level.name(), "LOG_DEBUG"}}); - - // or set log level with set_config and load network - core.set_property("AUTO", {{ov::log::level.name(), "LOG_DEBUG"}}); - ov::CompiledModel compiled_model2 = core.compile_model(model, "AUTO"); - -.. tab:: Python API - - .. code-block:: python - - from openvino.runtime import Core - core = Core() - - # read a network in IR, PaddlePaddle, or ONNX format - model = core.read_model(model_path) - - # load a network to AUTO and set log level to debug - compiled_model = core.compile_model(model=model, device_name="AUTO", config={"LOG_LEVEL":"LOG_DEBUG"}); - - // or set log level with set_config and load network - ie.SetConfig(config={"LOG_LEVEL":"LOG_DEBUG"}, device_name="AUTO"); - compiled_model = core.compile_model(model=model, device_name="AUTO"); + .. doxygensnippet:: docs/snippets/ov_auto.py + :language: python + :fragment: [part6] .. tab:: OS environment variable diff --git a/docs/snippets/AUTO6.cpp b/docs/snippets/AUTO6.cpp index f478304ac5e..7d661307c9d 100644 --- a/docs/snippets/AUTO6.cpp +++ b/docs/snippets/AUTO6.cpp @@ -8,10 +8,10 @@ ov::Core core; // read a network in IR, PaddlePaddle, or ONNX format std::shared_ptr model = core.read_model("sample.xml"); -// load a network to AUTO and set log level to debug +// compile a model on AUTO and set log level to debug ov::CompiledModel compiled_model = core.compile_model(model, "AUTO", ov::log::level(ov::log::Level::DEBUG)); -// or set log level with set_config and load network +// or set log level with set_property and compile model core.set_property("AUTO", ov::log::level(ov::log::Level::DEBUG)); ov::CompiledModel compiled_model2 = core.compile_model(model, "AUTO"); //! [part6] diff --git a/docs/snippets/ov_auto.py b/docs/snippets/ov_auto.py index d1304fffadb..cd65ab107e2 100644 --- a/docs/snippets/ov_auto.py +++ b/docs/snippets/ov_auto.py @@ -94,12 +94,25 @@ def part5(): compiled_model = core.compile_model(model=model, device_name="AUTO") #! [part5] +def part6(): +#! [part6] + core = Core() + # read a network in IR, PaddlePaddle, or ONNX format + model = core.read_model(model_path) + # compile a model on AUTO and set log level to debug + compiled_model = core.compile_model(model=model, device_name="AUTO", config={"LOG_LEVEL":"LOG_DEBUG"}); + # set log level with set_property and compile model + core.set_property(device_name="AUTO", properties={"LOG_LEVEL":"LOG_DEBUG"}); + compiled_model = core.compile_model(model=model, device_name="AUTO"); +#! [part6] + def main(): part0() part1() part3() part4() part5() + part6() if __name__ == '__main__': sys.exit(main())