Snake cased offline transformations API

This commit is contained in:
tomdol 2021-10-14 18:19:03 +02:00
parent 3345bf52d6
commit acb040bf0d
3 changed files with 19 additions and 19 deletions

View File

@ -1,6 +1,6 @@
from openvino.pyopenvino.offline_transformations import ApplyMOCTransformations
from openvino.pyopenvino.offline_transformations import ApplyPOTTransformations
from openvino.pyopenvino.offline_transformations import ApplyLowLatencyTransformation
from openvino.pyopenvino.offline_transformations import ApplyPruningTransformation
from openvino.pyopenvino.offline_transformations import GenerateMappingFile
from openvino.pyopenvino.offline_transformations import ApplyMakeStatefulTransformation
from openvino.pyopenvino.offline_transformations import apply_moc_transformations
from openvino.pyopenvino.offline_transformations import apply_pot_transformations
from openvino.pyopenvino.offline_transformations import apply_low_latency_transformation
from openvino.pyopenvino.offline_transformations import apply_pruning_transformation
from openvino.pyopenvino.offline_transformations import generate_mapping_file
from openvino.pyopenvino.offline_transformations import apply_make_stateful_transformation

View File

@ -21,7 +21,7 @@ void regmodule_offline_transformations(py::module m) {
py::module m_offline_transformations = m.def_submodule("offline_transformations", "Offline transformations module");
m_offline_transformations.def(
"ApplyMOCTransformations",
"apply_moc_transformations",
[](std::shared_ptr<ov::Function> function, bool cf) {
ov::pass::Manager manager;
manager.register_pass<ngraph::pass::MOCTransformations>(cf);
@ -31,7 +31,7 @@ void regmodule_offline_transformations(py::module m) {
py::arg("cf"));
m_offline_transformations.def(
"ApplyPOTTransformations",
"apply_pot_transformations",
[](std::shared_ptr<ov::Function> function, std::string device) {
ov::pass::Manager manager;
manager.register_pass<ngraph::pass::POTTransformations>(std::move(device));
@ -41,7 +41,7 @@ void regmodule_offline_transformations(py::module m) {
py::arg("device"));
m_offline_transformations.def(
"ApplyLowLatencyTransformation",
"apply_low_latency_transformation",
[](std::shared_ptr<ov::Function> function, bool use_const_initializer = true) {
ov::pass::Manager manager;
manager.register_pass<ov::pass::LowLatency2>(use_const_initializer);
@ -51,7 +51,7 @@ void regmodule_offline_transformations(py::module m) {
py::arg("use_const_initializer") = true);
m_offline_transformations.def(
"ApplyPruningTransformation",
"apply_pruning_transformation",
[](std::shared_ptr<ngraph::Function> function) {
ov::pass::Manager manager;
manager.register_pass<ngraph::pass::Pruning>();
@ -60,7 +60,7 @@ void regmodule_offline_transformations(py::module m) {
py::arg("function"));
m_offline_transformations.def(
"GenerateMappingFile",
"generate_mapping_file",
[](std::shared_ptr<ov::Function> function, std::string path, bool extract_names) {
ov::pass::Manager manager;
manager.register_pass<ngraph::pass::GenerateMappingFile>(path, extract_names);
@ -71,7 +71,7 @@ void regmodule_offline_transformations(py::module m) {
py::arg("extract_names"));
m_offline_transformations.def(
"ApplyMakeStatefulTransformation",
"apply_make_stateful_transformation",
[](std::shared_ptr<ov::Function> function, const std::map<std::string, std::string>& param_res_names) {
ngraph::pass::Manager manager;
manager.register_pass<ov::pass::MakeStateful>(param_res_names);

View File

@ -1,8 +1,8 @@
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.pyopenvino.offline_transformations import ApplyMOCTransformations, ApplyPOTTransformations, \
ApplyLowLatencyTransformation, ApplyPruningTransformation, ApplyMakeStatefulTransformation
from openvino.pyopenvino.offline_transformations import apply_moc_transformations, apply_pot_transformations, \
apply_low_latency_transformation, apply_pruning_transformation, apply_make_stateful_transformation
from ngraph.impl import Function, Shape
import ngraph as ng
@ -18,7 +18,7 @@ def get_test_function():
def test_moc_transformations():
function = get_test_function()
ApplyMOCTransformations(function, False)
apply_moc_transformations(function, False)
assert function is not None
assert len(function.get_ops()) == 3
@ -27,7 +27,7 @@ def test_moc_transformations():
def test_pot_transformations():
function = get_test_function()
ApplyPOTTransformations(function, "GNA")
apply_pot_transformations(function, "GNA")
assert function is not None
assert len(function.get_ops()) == 3
@ -36,7 +36,7 @@ def test_pot_transformations():
def test_low_latency_transformation():
function = get_test_function()
ApplyLowLatencyTransformation(function, True)
apply_low_latency_transformation(function, True)
assert function is not None
assert len(function.get_ops()) == 3
@ -45,7 +45,7 @@ def test_low_latency_transformation():
def test_pruning_transformation():
function = get_test_function()
ApplyPruningTransformation(function)
apply_pruning_transformation(function)
assert function is not None
assert len(function.get_ops()) == 3
@ -54,7 +54,7 @@ def test_pruning_transformation():
def test_make_stateful_transformations():
function = get_test_function()
ApplyMakeStatefulTransformation(function, {"parameter": "result"})
apply_make_stateful_transformation(function, {"parameter": "result"})
assert function is not None
assert len(function.get_parameters()) == 0