move priorbox to ie transformations to Opset1ToLegacyOpset pipeline

This commit is contained in:
Ivan Tikhonov 2020-09-10 13:36:11 +03:00
parent ef2581d5c6
commit 910e41ff20
4 changed files with 8 additions and 9 deletions

View File

@ -19,9 +19,9 @@ class TRANSFORMATIONS_API ConvertPriorBox;
} // namespace pass
} // namespace ngraph
class ngraph::pass::ConvertPriorBox: public ngraph::pass::GraphRewrite {
class ngraph::pass::ConvertPriorBox : public ngraph::pass::MatcherPass {
public:
ConvertPriorBox() : GraphRewrite() {
ConvertPriorBox() : {
convert_prior_box();
convert_prior_box_clustered();
}

View File

@ -7,7 +7,6 @@
#include "transformations/common_optimizations/algebraic_simplification.hpp"
#include "transformations/common_optimizations/nop_elimination.hpp"
#include "transformations/common_optimizations/common_optimizations.hpp"
#include "transformations/convert_opset1_to_legacy/convert_prior_to_ie_prior.hpp"
#include "transformations/depth_to_space_fusion.hpp"
#include "transformations/optimize_strided_slice.hpp"
#include "transformations/convert_scatter_elements_to_scatter.hpp"
@ -33,8 +32,6 @@ bool ngraph::pass::CommonOptimizations::run_on_function(std::shared_ptr<ngraph::
// This pass must be called first in pipeline
manager.register_pass<ngraph::pass::InitNodeInfo>();
manager.register_pass<ngraph::pass::ConvertPriorBox>(); // WA: ConvertPriorBox must be executed before CF
manager.register_pass<ngraph::pass::ConstantFolding>();
manager.register_pass<ngraph::pass::RemoveFilteringBoxesBySize>(); // Resolves dynamism (replaces NonZero), CF needed
manager.register_pass<ngraph::pass::ConvertQuantizeDequantize>();
manager.register_pass<ngraph::pass::ConstantFolding>();

View File

@ -24,6 +24,7 @@
#include <transformations/convert_opset1_to_legacy/convert_normalizel2_to_normalize_ie.hpp>
#include <transformations/convert_opset1_to_legacy/convert_one_hot_to_one_hot_ie.hpp>
#include <transformations/convert_opset1_to_legacy/convert_pad_to_pad_ie.hpp>
#include <transformations/convert_opset1_to_legacy/convert_prior_to_ie_prior.hpp>
#include <transformations/convert_opset1_to_legacy/convert_sqrt_to_power_ie.hpp>
#include <transformations/convert_opset1_to_legacy/convert_power_to_power_ie.hpp>
#include <transformations/convert_opset1_to_legacy/convert_prelu_to_relu_ie.hpp>
@ -161,6 +162,7 @@ bool ngraph::pass::ConvertOpSet1ToLegacy::run_on_function(std::shared_ptr<ngraph
anchor->add_matcher<ngraph::pass::ConvertGRUSequenceMatcher>();
anchor->add_matcher<ngraph::pass::ConvertRNNSequenceMatcher>();
anchor->add_matcher<ngraph::pass::ConvertLSTMSequenceMatcher>();
anchor->add_matcher<ngraph::pass::ConvertPriorBox>();
anchor->set_name("ngraph::pass::ConvertOpSet1ToLegacy");
// List of final conversion transformations that must to be executed

View File

@ -33,7 +33,7 @@ void ngraph::pass::ConvertPriorBox::convert_prior_box() {
auto prior_box = std::make_shared<ngraph::opset1::PriorBox>(data, image, attr);
auto unsqueeze = std::make_shared<ngraph::opset1::Unsqueeze> (prior_box, axes);
ngraph::graph_rewrite_callback callback = [](pattern::Matcher& m) {
ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) {
auto unsqueeze = std::dynamic_pointer_cast<ngraph::opset1::Unsqueeze> (m.get_match_root());
if (!unsqueeze) {
return false;
@ -152,7 +152,7 @@ void ngraph::pass::ConvertPriorBox::convert_prior_box() {
};
auto m = std::make_shared<ngraph::pattern::Matcher>(unsqueeze, "CPUFusion.ConvertPriorBoxToPriorBoxIE");
this->add_matcher(m, callback, PassProperty::CHANGE_DYNAMIC_STATE);
this->register_matcher(m, callback, PassProperty::CHANGE_DYNAMIC_STATE);
}
void ngraph::pass::ConvertPriorBox::convert_prior_box_clustered() {
@ -172,7 +172,7 @@ void ngraph::pass::ConvertPriorBox::convert_prior_box_clustered() {
auto prior_box = std::make_shared<ngraph::opset1::PriorBoxClustered>(data, image, attr);
auto unsqueeze = std::make_shared<ngraph::opset1::Unsqueeze> (prior_box, axes);
ngraph::graph_rewrite_callback callback = [](pattern::Matcher& m) {
ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) {
auto unsqueeze = std::dynamic_pointer_cast<ngraph::opset1::Unsqueeze> (m.get_match_root());
if (!unsqueeze) {
return false;
@ -290,5 +290,5 @@ void ngraph::pass::ConvertPriorBox::convert_prior_box_clustered() {
};
auto m = std::make_shared<ngraph::pattern::Matcher>(unsqueeze, "CPUFusion.ConvertPriorBoxClusteredToPriorBoxClusteredIE");
this->add_matcher(m, callback, PassProperty::CHANGE_DYNAMIC_STATE);
this->register_matcher(m, callback, PassProperty::CHANGE_DYNAMIC_STATE);
}