Updated documentation for serialize model (#14022)

This commit is contained in:
Ilya Churaev 2022-11-16 14:50:59 +04:00 committed by GitHub
parent 47b6155013
commit 6da7ee3431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 16 deletions

View File

@ -7,7 +7,6 @@
#include <openvino/opsets/opset8.hpp>
// ! [ov:include]
#include <openvino/pass/serialize.hpp>
#include <openvino/pass/visualize_tree.hpp>
#include <openvino/openvino.hpp>
#include <openvino/opsets/opset8.hpp>
@ -80,16 +79,8 @@ void ov_api_examples() {
}
// ! [ov:serialize]
void serialize_example(const std::shared_ptr<ov::Model>& f) {
// Need include:
// * openvino/pass/manager.hpp
// * openvino/pass/serialize.hpp
ov::pass::Manager manager;
// Serialize ov::Model to IR
manager.register_pass<ov::pass::Serialize>("/path/to/file/model.xml", "/path/to/file/model.bin");
manager.run_passes(f);
void serialize_example(const std::shared_ptr<ov::Model>& model) {
ov::serialize(model, "/path/to/file/model.xml", "/path/to/file/model.bin");
}
// ! [ov:serialize]

View File

@ -59,11 +59,8 @@ def ov_api_examples():
# ! [ov:serialize]
def serialize_example(m : ov.Model):
# Need import:
# * import openvino.runtime.passes as passes
pass_manager = passes.Manager()
pass_manager.register_pass(pass_name="Serialize", xml_path='model.xml', bin_path='model.bin')
pass_manager.run_passes(m)
from openvino.runtime import serialize
serialize(m, xml_path='model.xml', bin_path='model.bin')
# ! [ov:serialize]
# ! [ov:visualize]