From 8478bb6374bde987bca32f349ebc98190adc164e Mon Sep 17 00:00:00 2001 From: Gleb Kazantaev Date: Fri, 14 May 2021 14:09:20 +0300 Subject: [PATCH] Enable Pruning transformation by default inside Model Optimizer --- .../offline_transformations/src/moc_transformations.cpp | 8 +++++++- model-optimizer/mo/back/offline_transformations.py | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/inference-engine/src/offline_transformations/src/moc_transformations.cpp b/inference-engine/src/offline_transformations/src/moc_transformations.cpp index eec2491a28edbf..35f4a575c15c74 100644 --- a/inference-engine/src/offline_transformations/src/moc_transformations.cpp +++ b/inference-engine/src/offline_transformations/src/moc_transformations.cpp @@ -5,10 +5,16 @@ #include #include "moc_transformations.hpp" +#include "pruning.hpp" +#include NGRAPH_RTTI_DEFINITION(ngraph::pass::MOCTransformations, "MOCTransformations", 0); -bool ngraph::pass::MOCTransformations::run_on_function(std::shared_ptr) { +bool ngraph::pass::MOCTransformations::run_on_function(std::shared_ptr f) { + ngraph::pass::Manager m(get_pass_config()); + m.register_pass(); + m.run_passes(f); + return false; } \ No newline at end of file diff --git a/model-optimizer/mo/back/offline_transformations.py b/model-optimizer/mo/back/offline_transformations.py index e9069547484e94..5d6cb2ab11883f 100644 --- a/model-optimizer/mo/back/offline_transformations.py +++ b/model-optimizer/mo/back/offline_transformations.py @@ -35,6 +35,7 @@ def apply_offline_transformations(input_model: str, framework: str, transforms: available_transformations[name](net, **args) + ApplyMOCTransformations(net, False) net.serialize(input_model + ".xml", input_model + ".bin") path_to_mapping = input_model + ".mapping" GenerateMappingFile(net, path_to_mapping.encode('utf-8'), extract_names)