Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Revert "Add transformation pipeline to PrePostProcessing (#28852)" #29109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/bindings/python/tests/test_graph/test_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ def test_graph_preprocess_scale_vector():
assert list(model.get_output_shape(0)) == [2, 2]
assert model.get_output_element_type(0) == Type.f32
assert "Constant" in model_operators
# Div will be converted to Mul in the transformations
assert "Multiply" in model_operators
assert "Divide" in model_operators


def test_graph_preprocess_mean_scale_convert():
Expand All @@ -96,13 +95,12 @@ def custom_preprocess(output: Output):
model = ppp.build()

model_operators = [op.get_name().split("_")[0] for op in model.get_ops()]
# Div will be converted to Mul in the transformations
expected_ops = [
"Parameter",
"Convert",
"Constant",
"Subtract",
"Multiply",
"Divide",
"Result",
"Abs",
]
Expand Down Expand Up @@ -139,13 +137,12 @@ def custom_preprocess(output: Output):
model = ppp.build()

model_operators = [op.get_name().split("_")[0] for op in model.get_ops()]
# Div will be converted to Mul in the transformations
expected_ops = [
"Parameter",
"Convert",
"Constant",
"Subtract",
"Multiply",
"Divide",
"Result",
"Abs",
]
Expand Down Expand Up @@ -407,7 +404,7 @@ def test_graph_preprocess_steps(algorithm, color_format1, color_format2, is_fail
"Gather",
"Interpolate",
]
assert len(model_operators) == 12
assert len(model_operators) == 15
assert model.get_output_size() == 1
assert list(model.get_output_shape(0)) == [1, 3, 3, 3]
assert model.get_output_element_type(0) == Type.f32
Expand Down Expand Up @@ -459,9 +456,10 @@ def test_graph_preprocess_postprocess_layout():
"Constant",
"Result",
"Gather",
"Range",
"Transpose",
]
assert len(model_operators) == 11
assert len(model_operators) == 14
assert model.get_output_size() == 1
assert list(model.get_output_shape(0)) == [1, 1, 3, 3]
assert model.get_output_element_type(0) == Type.f32
Expand All @@ -488,8 +486,9 @@ def test_graph_preprocess_reverse_channels():
"Constant",
"Result",
"Gather",
"Range",
]
assert len(model_operators) == 7
assert len(model_operators) == 10
assert model.get_output_size() == 1
assert list(model.get_output_shape(0)) == [1, 2, 2, 2]
assert model.get_output_element_type(0) == Type.f32
Expand Down Expand Up @@ -629,7 +628,6 @@ def custom_preprocess(output: Output):
model = ppp.build()

model_operators = [op.get_name().split("_")[0] for op in model.get_ops()]
# Div will be converted to Mul in the transformations
expected_ops = [
"Parameter",
"Constant",
Expand All @@ -638,7 +636,7 @@ def custom_preprocess(output: Output):
"Convert",
"Abs",
"Add",
"Multiply",
"Divide",
]
assert len(model_operators) == 13
assert model.get_output_size() == 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ TRANSFORMATIONS_API void mark_as_dequantization_node(const std::shared_ptr<Node>

TRANSFORMATIONS_API bool is_dequantization_node(const std::shared_ptr<const Node>& node);

TRANSFORMATIONS_API void unmark_dequantization_node(const std::shared_ptr<Node>& node);

/**
* @ingroup ov_runtime_attr_api
* @brief DequantizationNode class represents runtime info attribute that marks operation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,8 @@ bool ov::pass::MOCTransformations::run_on_model(const std::shared_ptr<ov::Model>
using namespace ov::pass;
REGISTER_PASS(manager, InitNodeInfo)
if (m_low_precision_enabled) {
manager.register_pass<ov::pass::MarkDequantization>(element::TypeVector{ov::element::i8,
ov::element::u8,
ov::element::i4,
ov::element::u4,
ov::element::nf4,
ov::element::f4e2m1,
ov::element::f8e4m3,
ov::element::f8e5m2,
ov::element::f8e8m0});
manager.register_pass<ov::pass::MarkDequantization>(
element::TypeVector{ov::element::i8, ov::element::u8, ov::element::i4, ov::element::u4});
}
if (!m_use_shapes) {
manager.register_pass<ov::pass::DisableShapeOfConstantFolding>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ void ov::mark_as_dequantization_node(const std::shared_ptr<Node>& node) {
rt_info[DequantizationNode::get_type_info_static()] = DequantizationNode();
}

void ov::unmark_dequantization_node(const std::shared_ptr<Node>& node) {
node->get_rt_info().erase(DequantizationNode::get_type_info_static());
}

bool ov::is_dequantization_node(const std::shared_ptr<const Node>& node) {
const auto& rt_info = node->get_rt_info();
return rt_info.find(DequantizationNode::get_type_info_static()) != rt_info.end();
Expand Down
Loading
Loading