[GNA] Update documentation (cherry-pick from release) (#10974)
* [GNA] Update documentation (release) (#10873)
* parent 5f755d5e4a
author Nadezhda Ageeva <nadezhda.ageeva@intel.com> 1646919359 +0300
committer Nadezhda Ageeva <nadezhda.ageeva@intel.com> 1647270928 +0300
[GNA] Updte documentation (release)
Update docs/OV_Runtime_UG/supported_plugins/GNA.md
Co-authored-by: Denis Orlov <denis.orlov@intel.com>
Update docs/OV_Runtime_UG/supported_plugins/GNA.md
Co-authored-by: Denis Orlov <denis.orlov@intel.com>
Update docs/OV_Runtime_UG/supported_plugins/GNA.md
Co-authored-by: Denis Orlov <denis.orlov@intel.com>
Update docs/OV_Runtime_UG/supported_plugins/GNA.md
Co-authored-by: Denis Orlov <denis.orlov@intel.com>
Apply comments
Move snippets to separate file
Add notes about POT and 2d convolutions
* Add lins to GNA setup
* cleanup after rebase
* [GNA] small docs fixes (#10959)
* [GNA] small docs fixes
* Update docs/OV_Runtime_UG/supported_plugins/GNA.md
Co-authored-by: Victoria Yashina <victoria.yashina@intel.com>
* Update docs/OV_Runtime_UG/supported_plugins/GNA.md
Co-authored-by: Victoria Yashina <victoria.yashina@intel.com>
* Update docs/OV_Runtime_UG/supported_plugins/GNA.md
Co-authored-by: Victoria Yashina <victoria.yashina@intel.com>
Co-authored-by: Victoria Yashina <victoria.yashina@intel.com>
Co-authored-by: Victoria Yashina <victoria.yashina@intel.com>
This commit is contained in:
14 files changed
+30838
-479
No files matched your search
@@ -0,0 +1,17 @@
|
||||
// Copyright (C) 2022 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//! [include]
|
||||
#include <openvino/openvino.hpp>
|
||||
#include <openvino/runtime/intel_gna/properties.hpp>
|
||||
//! [include]
|
||||
|
||||
int main() {
|
||||
const std::string model_path = "model.xml";
|
||||
//! [ov_gna_exec_mode_hw_with_sw_fback]
|
||||
ov::Core core;
|
||||
auto model = core.read_model(model_path);
|
||||
auto compiled_model = core.compile_model(model, "GNA",
|
||||
ov::intel_gna::execution_mode(ov::intel_gna::ExecutionMode::HW_WITH_SW_FBACK));
|
||||
//! [ov_gna_exec_mode_hw_with_sw_fback]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#! [import]
|
||||
from openvino.runtime import Core
|
||||
#! [import]
|
||||
|
||||
model_path = "model.xml"
|
||||
|
||||
#! [ov_gna_exec_mode_hw_with_sw_fback]
|
||||
core = Core()
|
||||
model = core.read_model(model=model_path)
|
||||
compiled_model = core.compile_model(model, device_name="GNA",
|
||||
config={ 'GNA_DEVICE_MODE' : 'GNA_HW_WITH_SW_FBACK'})
|
||||
#! [ov_gna_exec_mode_hw_with_sw_fback]
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2022 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//! [include]
|
||||
#include <fstream>
|
||||
#include <openvino/openvino.hpp>
|
||||
//! [include]
|
||||
|
||||
int main() {
|
||||
const std::string model_path = "model.xml";
|
||||
const std::string blob_path = "compiled_model.blob";
|
||||
|
||||
ov::Core core;
|
||||
auto model = core.read_model(model_path);
|
||||
auto compiled_model = core.compile_model(model, "GNA");
|
||||
|
||||
{
|
||||
//! [ov_gna_export]
|
||||
std::ofstream ofs(blob_path, std::ios_base::binary | std::ios::out);
|
||||
compiled_model.export_model(ofs);
|
||||
//! [ov_gna_export]
|
||||
}
|
||||
{
|
||||
//! [ov_gna_import]
|
||||
std::ifstream ifs(blob_path, std::ios_base::binary | std::ios_base::in);
|
||||
auto compiled_model = core.import_model(ifs, "GNA");
|
||||
//! [ov_gna_import]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#! [import]
|
||||
from openvino.runtime import Core
|
||||
from io import BytesIO
|
||||
#! [import]
|
||||
|
||||
model_path = "model.xml"
|
||||
blob_path = "compiled_model.blob"
|
||||
|
||||
core = Core()
|
||||
model = core.read_model(model=model_path)
|
||||
compiled_model = core.compile_model(model, device_name="GNA")
|
||||
|
||||
#! [ov_gna_export]
|
||||
user_stream = compiled_model.export_model()
|
||||
with open(blob_path, 'wb') as f:
|
||||
f.write(user_stream)
|
||||
#! [ov_gna_export]
|
||||
|
||||
# [ov_gna_import]
|
||||
with open(blob_path, 'rb') as f:
|
||||
buf = BytesIO(f.read())
|
||||
compiled_model = core.import_model(buf, device_name="GNA")
|
||||
# [ov_gna_import]
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2022 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
//! [include]
|
||||
#include <openvino/openvino.hpp>
|
||||
//! [include]
|
||||
|
||||
int main() {
|
||||
const std::string model_path = "model.xml";
|
||||
size_t batch_size = 8;
|
||||
|
||||
//! [ov_gna_read_model]
|
||||
ov::Core core;
|
||||
auto model = core.read_model(model_path);
|
||||
//! [ov_gna_read_model]
|
||||
|
||||
//! [ov_gna_set_nc_layout]
|
||||
ov::preprocess::PrePostProcessor ppp(model);
|
||||
for (const auto& input : model->inputs()) {
|
||||
auto& in = ppp.input(input.get_any_name());
|
||||
in.model().set_layout(ov::Layout("N?"));
|
||||
}
|
||||
model = ppp.build();
|
||||
//! [ov_gna_set_nc_layout]
|
||||
|
||||
//! [ov_gna_set_batch_size]
|
||||
ov::set_batch(model, batch_size);
|
||||
//! [ov_gna_set_batch_size]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#! [import]
|
||||
from openvino.runtime import Core, set_batch
|
||||
from openvino.preprocess import PrePostProcessor
|
||||
#! [import]
|
||||
|
||||
model_path = "model.xml"
|
||||
batch_size = 8
|
||||
|
||||
#! [ov_gna_read_model]
|
||||
core = Core()
|
||||
model = core.read_model(model=model_path)
|
||||
#! [ov_gna_read_model]
|
||||
|
||||
#! [ov_gna_set_nc_layout]
|
||||
ppp = PrePostProcessor(model)
|
||||
for i in range(len(model.inputs)):
|
||||
input_name = model.input(i).get_any_name()
|
||||
ppp.input(i).model().set_layout("N?")
|
||||
model = ppp.build()
|
||||
#! [ov_gna_set_nc_layout]
|
||||
|
||||
#! [ov_gna_set_batch_size]
|
||||
set_batch(model, batch_size)
|
||||
#! [ov_gna_set_batch_size]
|
||||
Reference in new issue
Block a user