Preserve RTInfo in output ports (#10114)

* Automation for preserving rt info in output ports; Update FunctionComparator to compare rt info correctly

* Update LPT tests to use real rt_info attributes, so they can be compared

* Fix tests
This commit is contained in:
Gleb Kazantaev
2022-02-09 12:09:23 +03:00
committed by GitHub
parent 0168bda833
commit 4fdf71cdc1
90 changed files with 235 additions and 195 deletions

View File

@@ -22,6 +22,9 @@ void copy_runtime_info(const ngraph::NodeVector& from, std::shared_ptr<ngraph::N
NGRAPH_API
void copy_runtime_info(const ngraph::NodeVector& from, ngraph::NodeVector to);
NGRAPH_API
void copy_output_runtime_info(const ngraph::OutputVector& from, ngraph::OutputVector to);
} // namespace ngraph
using ngraph::copy_runtime_info;

View File

@@ -32,6 +32,7 @@ public:
virtual bool is_copyable() const;
virtual Any init(const std::shared_ptr<Node>& node) const;
virtual Any merge(const ov::NodeVector& nodes) const;
virtual Any merge(const ov::OutputVector& outputs) const;
virtual std::string to_string() const;
virtual bool visit_attributes(AttributeVisitor&);
bool visit_attributes(AttributeVisitor& visitor) const {

View File

@@ -70,6 +70,7 @@ void collect_wrap_info(std::vector<DiscreteTypeInfo>& info) {
collect_wrap_info<T>(info);
collect_wrap_info<Targs...>(info);
}
template <class... Args>
std::shared_ptr<Node> wrap_type(const OutputVector& inputs, const pattern::op::ValuePredicate& pred) {
std::vector<DiscreteTypeInfo> info;

View File

@@ -5,6 +5,7 @@
#include "openvino/core/node_output.hpp"
#include "ngraph/log.hpp"
#include "ngraph/rt_info.hpp"
#include "ngraph/variant.hpp"
#include "openvino/core/node.hpp"
#include "openvino/op/parameter.hpp"
@@ -84,6 +85,8 @@ void Output<Node>::replace(const Output<Node>& replacement) {
replacement.get_tensor_ptr()->set_name(get_tensor_ptr()->get_name());
}
NGRAPH_SUPPRESS_DEPRECATED_END
ngraph::copy_output_runtime_info({*this, replacement}, {replacement});
}
RTMap& Output<Node>::get_rt_info() {

View File

@@ -9,7 +9,23 @@
namespace {
ngraph::Node::RTMap mergeRuntimeInfo(const ngraph::NodeVector& nodes) {
std::unordered_map<std::string, std::vector<ov::Any>> get_copyable_attrs(const ngraph::OutputVector& outputs) {
std::unordered_map<std::string, std::vector<ov::Any>> attrs;
for (const auto& output : outputs) {
for (const auto& item : output.get_rt_info()) {
bool copy = true;
if (item.second.is<ov::RuntimeAttribute>()) {
copy = item.second.as<ov::RuntimeAttribute>().is_copyable();
}
if (copy) {
attrs[item.first].push_back(item.second);
}
}
}
return attrs;
}
std::unordered_map<std::string, std::vector<ov::Any>> get_copyable_attrs(const ngraph::NodeVector& nodes) {
std::unordered_map<std::string, std::vector<ov::Any>> attrs;
for (const auto& node : nodes) {
for (const auto& item : node->get_rt_info()) {
@@ -22,6 +38,12 @@ ngraph::Node::RTMap mergeRuntimeInfo(const ngraph::NodeVector& nodes) {
}
}
}
return attrs;
}
template <typename T>
ngraph::Node::RTMap mergeRuntimeInfo(const T& items) {
std::unordered_map<std::string, std::vector<ov::Any>> attrs = get_copyable_attrs(items);
ngraph::Node::RTMap merged_attrs;
for (auto& item : attrs) {
@@ -30,7 +52,7 @@ ngraph::Node::RTMap mergeRuntimeInfo(const ngraph::NodeVector& nodes) {
merged_attrs[item.first] = attr;
} else {
if (attr.is<ov::RuntimeAttribute>()) {
auto merge_attr = attr.as<ov::RuntimeAttribute>().merge(nodes);
auto merge_attr = attr.as<ov::RuntimeAttribute>().merge(items);
if (!merge_attr.empty()) {
merged_attrs[item.first] = merge_attr;
}
@@ -98,3 +120,11 @@ void ngraph::copy_runtime_info(const ngraph::NodeVector& from, ngraph::NodeVecto
assign_runtime_info(mergedInfo, rtInfoTo);
}
}
void ngraph::copy_output_runtime_info(const ngraph::OutputVector& from, ngraph::OutputVector to) {
auto mergedInfo = mergeRuntimeInfo(from);
for (auto& node : to) {
auto& rtInfoTo = node.get_rt_info();
assign_runtime_info(mergedInfo, rtInfoTo);
}
}

View File

@@ -24,6 +24,10 @@ Any RuntimeAttribute::merge(const ngraph::NodeVector& nodes) const {
return {};
}
Any RuntimeAttribute::merge(const ngraph::OutputVector& outputs) const {
return {};
}
bool RuntimeAttribute::is_copyable() const {
return true;
}

View File

@@ -38,47 +38,32 @@ bool compare_type_info(const ngraph::DiscreteTypeInfo& info1, const ngraph::Disc
return info1Name == info2Name;
}
template <typename Node>
bool compare_rt_keys(const Node& node1, const Node& node2) {
// The "opset" parameter in RT info is optional
// and mandatory only for TypeRelaxed operations.
// Therefore, we ignore this key when comparing RT keys.
const auto& first_node_rt_info = node1->get_rt_info();
const auto& second_node_rt_info = node2->get_rt_info();
template <typename T>
bool compare_rt_keys(const T& node1, const T& node2, std::ostream& err_log) {
const auto& first_node_rt_info = node1.get_rt_info();
const auto& second_node_rt_info = node2.get_rt_info();
auto first_node_rt_info_it = first_node_rt_info.begin();
auto second_node_rt_info_it = second_node_rt_info.begin();
while (first_node_rt_info_it != first_node_rt_info.end() && second_node_rt_info_it != second_node_rt_info.end()) {
std::stringstream strm;
first_node_rt_info_it->second.print(strm);
strm << " ";
second_node_rt_info_it->second.print(strm);
bool is_continue = false;
if (first_node_rt_info_it->first == "opset") {
++first_node_rt_info_it;
is_continue = true;
}
if (second_node_rt_info_it->first == "opset") {
++second_node_rt_info_it;
is_continue = true;
}
if (is_continue)
for (const auto& attr : second_node_rt_info) {
const auto& key = attr.first;
// TODO: remove this check after 77716 is implemented
if (key == "opset") {
continue;
if (first_node_rt_info_it->first != second_node_rt_info_it->first) {
}
auto value1 = first_node_rt_info.find(key);
if (value1 == first_node_rt_info.end()) {
err_log << "Key: " << key << " is missing.\n";
return false;
}
++first_node_rt_info_it;
++second_node_rt_info_it;
try {
if (value1->second != attr.second) {
err_log << "Values for " << key << " key are not equal.\n";
return false;
}
} catch (ov::Exception& e) {
// Handle cases wen equality operator is not defined for some rt attribute
}
}
if (first_node_rt_info_it != first_node_rt_info.end() && first_node_rt_info_it->first == "opset") {
++first_node_rt_info_it;
}
if (second_node_rt_info_it != second_node_rt_info.end() && second_node_rt_info_it->first == "opset") {
++second_node_rt_info_it;
}
return first_node_rt_info_it == first_node_rt_info.end() && second_node_rt_info_it == second_node_rt_info.end();
return true;
}
bool less_by_name(const std::shared_ptr<ngraph::op::v0::Result>& l, const std::shared_ptr<ngraph::op::v0::Result>& r) {
@@ -539,8 +524,8 @@ Comparator::Result compare_io(ov::op::util::SubGraphOp* sub_lhs, ov::op::util::S
}
} // namespace subgraph
} // namespace
Comparator::Result Comparator::compare(const std::shared_ptr<ngraph::Function>& f1,
const std::shared_ptr<ngraph::Function>& f2) {
Comparator::Result Comparator::compare(const std::shared_ptr<ngraph::Function>& f,
const std::shared_ptr<ngraph::Function>& f_ref) {
/*
* This function compares two nGraph functions and requires them to have exactly one output
* + Check nodes types
@@ -550,47 +535,47 @@ Comparator::Result Comparator::compare(const std::shared_ptr<ngraph::Function>&
* + Check node attributes by Visitor API
*/
auto f1_results = f1->get_results();
auto f2_results = f2->get_results();
auto f_results = f->get_results();
auto f_ref_results = f_ref->get_results();
auto cmp = less_by_name;
// In case if Result source output has more than one name so the Result may have any of this names as a friendly
// name And in case of multiple names we sort Result operation using their parent node names
if (std::any_of(f1_results.begin(),
f1_results.end(),
// name An in case of multiple names we sort Result operation using their parent node names
if (std::any_of(f_results.begin(),
f_results.end(),
[](const std::shared_ptr<ngraph::Node>& node) {
const auto& t = node->input_value(0).get_tensor_ptr();
return t->get_names().size() > 1;
}) ||
std::any_of(f2_results.begin(), f2_results.end(), [](const std::shared_ptr<ngraph::Node>& node) {
std::any_of(f_ref_results.begin(), f_ref_results.end(), [](const std::shared_ptr<ngraph::Node>& node) {
const auto& t = node->input_value(0).get_tensor_ptr();
return t->get_names().size() > 1;
})) {
cmp = less_by_parent_name;
}
std::sort(f1_results.begin(), f1_results.end(), cmp);
std::sort(f2_results.begin(), f2_results.end(), cmp);
std::sort(f_results.begin(), f_results.end(), cmp);
std::sort(f_ref_results.begin(), f_ref_results.end(), cmp);
if (f1_results.size() != f2_results.size()) {
return Result::error("Number of results is different: " + to_str(f1_results.size()) + " and " +
to_str(f2_results.size()));
if (f_results.size() != f_ref_results.size()) {
return Result::error("Number of results is different: " + to_str(f_results.size()) + " and " +
to_str(f_ref_results.size()));
}
const auto& f1_sinks = f1->get_sinks();
const auto& f2_sinks = f2->get_sinks();
if (f1_sinks.size() != f2_sinks.size()) {
return Result::error("Number of sinks is different: " + to_str(f1_sinks.size()) + " and " +
to_str(f2_sinks.size()));
const auto& f_sinks = f->get_sinks();
const auto& f_ref_sinks = f_ref->get_sinks();
if (f_sinks.size() != f_ref_sinks.size()) {
return Result::error("Number of sinks is different: " + to_str(f_sinks.size()) + " and " +
to_str(f_ref_sinks.size()));
}
// Compare sinks
if (f1_sinks.size() == 1) {
q.push({f1_sinks[0].get(), f2_sinks[0].get()});
used.insert(f1_sinks[0].get());
if (f_sinks.size() == 1) {
q.push({f_sinks[0].get(), f_ref_sinks[0].get()});
used.insert(f_sinks[0].get());
} else {
// Cast to Assign and find those that have same variable_id suffix
for (const auto& sink1 : f1_sinks) {
for (const auto& sink1 : f_sinks) {
auto assign1 = std::dynamic_pointer_cast<ov::op::util::VariableExtension>(sink1);
if (!assign1) {
return Result::error("Sink '" + name(sink1) +
@@ -598,7 +583,7 @@ Comparator::Result Comparator::compare(const std::shared_ptr<ngraph::Function>&
}
auto name1 = assign1->get_variable_id();
std::shared_ptr<ov::op::Sink> found_sink2;
for (const auto& sink2 : f2_sinks) {
for (const auto& sink2 : f_ref_sinks) {
auto assign2 = std::dynamic_pointer_cast<ov::op::util::VariableExtension>(sink2);
if (!assign2) {
return Result::error("Sink '" + name(sink2) +
@@ -618,17 +603,17 @@ Comparator::Result Comparator::compare(const std::shared_ptr<ngraph::Function>&
}
}
for (size_t i = 0; i < f1_results.size(); ++i) {
for (size_t i = 0; i < f_results.size(); ++i) {
if (should_compare(CmpValues::NAMES)) {
if (name(f1_results[i]->get_input_node_shared_ptr(0)) !=
name(f2_results[i]->get_input_node_shared_ptr(0))) {
if (name(f_results[i]->get_input_node_shared_ptr(0)) !=
name(f_ref_results[i]->get_input_node_shared_ptr(0))) {
return Result::error(
"Different output node names: " + name(f1_results[i]->get_input_node_shared_ptr(0)) + " and " +
name(f2_results[i]->get_input_node_shared_ptr(0)));
"Different output node names: " + name(f_results[i]->get_input_node_shared_ptr(0)) + " and " +
name(f_ref_results[i]->get_input_node_shared_ptr(0)));
}
}
q.push({f1_results[i].get(), f2_results[i].get()});
used.insert(f1_results[i].get());
q.push({f_results[i].get(), f_ref_results[i].get()});
used.insert(f_results[i].get());
}
std::stringstream errors;
@@ -692,13 +677,7 @@ Comparator::Result Comparator::compare(ngraph::Node* node1, ngraph::Node* node2,
compare_outputs(node1, node2, err_log);
}
if (should_compare(CmpValues::ATTRIBUTES)) {
const auto result = attributes::compare(node1, node2, m_comparison_flags);
if (!result.valid) {
return result;
}
}
compare_nodes(node1, node2, err_log);
return Result::ok("Check if any minor error was log in to err_log");
}
@@ -739,15 +718,15 @@ void Comparator::compare_inputs(ngraph::Node* node1, ngraph::Node* node2, std::o
<< " Input(" << i << ") connected to parent port " << idx2 << std::endl;
}
if (should_compare(CmpValues::RUNTIME_KEYS) && !compare_rt_keys(node1, node2)) {
err_log << "Different runtime info detected\n"
if (should_compare(CmpValues::RUNTIME_KEYS) && !compare_rt_keys(node1->input(i), node2->input(i), err_log)) {
err_log << "Different runtime info detected at input(" << i << ")\n"
<< name(node1) << " and " << name(node2) << " not equal runtime info." << std::endl;
}
}
}
void Comparator::compare_outputs(ngraph::Node* node1, ngraph::Node* node2, std::ostream& err_log) {
// Some transformations creates new tensors with autogenerated names
// Some transformations create new tensors with autogenerated names
for (int i = 0; i < node1->outputs().size(); ++i) {
const auto& tensor1 = node1->output(i).get_tensor();
const auto& tensor2 = node2->output(i).get_tensor();
@@ -765,6 +744,24 @@ void Comparator::compare_outputs(ngraph::Node* node1, ngraph::Node* node2, std::
<< name(node1) << " Output(" << i << ") " << node1->output(i).get_partial_shape() << " and "
<< name(node2) << " Output(" << i << ") " << node2->output(i).get_partial_shape() << std::endl;
}
if (should_compare(CmpValues::RUNTIME_KEYS) && !compare_rt_keys(node1->output(i), node2->output(i), err_log)) {
err_log << "Different runtime info detected at output(" << i << ")\n"
<< name(node1) << " and " << name(node2) << " not equal runtime info." << std::endl;
}
}
}
void Comparator::compare_nodes(ngraph::Node* node1, ngraph::Node* node2, std::ostream& err_log) {
if (should_compare(CmpValues::RUNTIME_KEYS) && !compare_rt_keys(*node1, *node2, err_log)) {
err_log << "Different runtime info detected\n" + name(node1) + " and " + name(node2) +
" not equal runtime info.\n";
}
if (should_compare(CmpValues::ATTRIBUTES)) {
auto res = attributes::compare(node1, node2, m_comparison_flags);
if (!res.valid)
err_log << res.message;
}
}
@@ -777,9 +774,9 @@ void Comparator::add_nodes_inputs_to_queue(ngraph::Node* node1, ngraph::Node* no
}
}
FunctionsComparator::Result FunctionsComparator::compare(const std::shared_ptr<ngraph::Function>& f1,
const std::shared_ptr<ngraph::Function>& f2) const {
return Comparator(m_comparison_flags).compare(f1, f2);
FunctionsComparator::Result FunctionsComparator::compare(const std::shared_ptr<ngraph::Function>& f,
const std::shared_ptr<ngraph::Function>& f_ref) const {
return Comparator(m_comparison_flags).compare(f, f_ref);
}
void check_rt_info(const std::shared_ptr<ngraph::Function>& f) {

View File

@@ -49,17 +49,20 @@ public:
fc.enable(TENSOR_NAMES);
return fc;
}
FunctionsComparator& enable(CmpValues f) noexcept {
m_comparison_flags = static_cast<CmpValues>(m_comparison_flags | f);
return *this;
}
bool should_compare(CmpValues f) const noexcept {
return m_comparison_flags & f;
}
Result compare(const std::shared_ptr<ngraph::Function>& f1, const std::shared_ptr<ngraph::Function>& f2) const;
Result compare(const std::shared_ptr<ngraph::Function>& f, const std::shared_ptr<ngraph::Function>& f_ref) const;
Result operator()(const std::shared_ptr<ngraph::Function>& f1, const std::shared_ptr<ngraph::Function>& f2) const {
return compare(f1, f2);
Result operator()(const std::shared_ptr<ngraph::Function>& f,
const std::shared_ptr<ngraph::Function>& f_ref) const {
return compare(f, f_ref);
}
private:
@@ -71,8 +74,8 @@ private:
/// \deprecated
/// \brief compare_functions is obsolete function use FunctionsComparator instead.
///
inline std::pair<bool, std::string> compare_functions(const std::shared_ptr<ngraph::Function>& f1,
const std::shared_ptr<ngraph::Function>& f2,
inline std::pair<bool, std::string> compare_functions(const std::shared_ptr<ngraph::Function>& f,
const std::shared_ptr<ngraph::Function>& f_ref,
const bool compareConstValues = false,
const bool compareNames = false,
const bool compareRuntimeKeys = false,
@@ -95,7 +98,7 @@ inline std::pair<bool, std::string> compare_functions(const std::shared_ptr<ngra
if (compareTensorNames)
fc.enable(Cmp::TENSOR_NAMES);
const auto r = fc(f1, f2);
const auto r = fc(f, f_ref);
return {r.valid, r.message};
}
@@ -270,7 +273,7 @@ public:
explicit Comparator(CmpValues f) : m_comparison_flags(f) {}
Result compare(const std::shared_ptr<ngraph::Function>& f1, const std::shared_ptr<ngraph::Function>& f2);
Result compare(const std::shared_ptr<ngraph::Function>& f, const std::shared_ptr<ngraph::Function>& f_ref);
Result compare(ngraph::Node* node1, ngraph::Node* node2) {
std::stringstream errors;
@@ -290,6 +293,8 @@ public:
void compare_outputs(ngraph::Node* node1, ngraph::Node* node2, std::ostream& err_log);
void compare_nodes(ngraph::Node* node1, ngraph::Node* node2, std::ostream& err_log);
private:
bool should_compare(CmpValues f) const noexcept {
return m_comparison_flags & f;

View File

@@ -150,7 +150,7 @@ public:
TEST_P(AddTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -129,7 +129,7 @@ TEST_P(AlignConcatQuantizationParametersTransformation, CompareFunctions) {
InitNodeInfo().run_on_model(actualFunction);
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -109,7 +109,7 @@ public:
TEST_P(AssignTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -110,7 +110,7 @@ TEST_P(AvgPoolTransformation, CompareFunctions) {
InitNodeInfo().run_on_model(actualFunction);
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -110,7 +110,7 @@ TEST_P(AvgPoolWithChildTransformation, CompareFunctions) {
InitNodeInfo().run_on_model(actualFunction);
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -96,7 +96,7 @@ public:
TEST_P(ClampTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -89,7 +89,7 @@ public:
TEST_P(ComposeFakeQuantizeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, false, false);
auto res = compare_functions(actualFunction, referenceFunction, true, false, false);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -127,7 +127,7 @@ public:
TEST_P(ConcatSelectionWithIntermediateTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -225,7 +225,7 @@ public:
TEST_P(ConcatTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -135,7 +135,7 @@ public:
TEST_P(ConcatWithDifferentChildrenTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -136,7 +136,7 @@ public:
TEST_P(ConcatWithIntermediatePrecisionSelectionTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, false, false);
auto res = compare_functions(actualFunction, referenceFunction, true, false, false);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -108,7 +108,7 @@ public:
TEST_P(ConcatWithIntermediateReshapeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -133,7 +133,7 @@ public:
TEST_P(ConcatWithIntermediateTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -135,7 +135,7 @@ public:
TEST_P(ConcatWithIntermediateWithConstantTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -153,7 +153,7 @@ public:
TEST_P(ConcatWithNeighborsTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -154,7 +154,7 @@ public:
TEST_P(ConcatWithNeighborsWithConvolutionTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
//auto res = compare_functions(referenceFunction, actualFunction, true, false, false);
//auto res = compare_functions(actualFunction, referenceFunction, true, false, false);
//ASSERT_TRUE(res.first) << res.second;
auto actualFakeQuantizes = LayerTransformation::get<opset1::FakeQuantize>(actualFunction);

View File

@@ -247,7 +247,7 @@ public:
TEST_P(ConcatWithNotQuantizedParentTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false, true, false);
ASSERT_TRUE(res.first) << res.second;
auto actualFakeQuantizes = LayerTransformation::get<opset1::FakeQuantize>(actualFunction);

View File

@@ -118,7 +118,7 @@ public:
TEST_P(ConcatWithReshapeAtTheEndTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -151,7 +151,7 @@ public:
TEST_P(ConcatWithSplitTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -145,7 +145,7 @@ public:
TEST_P(ConcatWithStridedSliceTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true);
auto res = compare_functions(actualFunction, referenceFunction, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -98,7 +98,7 @@ public:
TEST_P(ConvertSubtractConstantTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
}
@@ -170,7 +170,7 @@ const std::vector<ConvertSubtractConstantTransformationTestValues> testValues =
{
{ ngraph::element::f32, false },
{ {127.f}, element::f32, {}, false, 1ul, element::i8, true, {},
{ ov::pass::DisableConstantFolding::get_type_info_static() } },
{ {ov::pass::DisableConstantFolding::get_type_info_static(), ov::pass::DisableConstantFolding()} } },
{ {0.03f}, element::f32, {}, false }
},
{ std::vector<float>{ 2.f }, ngraph::element::i8},

View File

@@ -192,7 +192,7 @@ public:
TEST_P(ConvolutionBackpropDataTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
@@ -285,7 +285,7 @@ const std::vector<ConvolutionBackpropDataTransformationTestValues> testValues =
ngraph::element::u8,
{{}, { { 128.f }, ngraph::element::f32, {}, false }, {}},
{{}, { { 2.f }, ngraph::element::f32, {1, 2, 1, 1}, true, 1ul, element::i8, false,
{ ov::pass::DisableConstantFolding::get_type_info_static() } }, {}},
{ {ov::pass::DisableConstantFolding::get_type_info_static(), ov::pass::DisableConstantFolding()} } }, {}},
{{}, {}, {{ 0.0002f }, ngraph::element::f32, {}}},
op::Constant::create(ngraph::element::i8, ngraph::Shape{}, std::vector<float>{ 2.f }),
true

View File

@@ -99,7 +99,7 @@ public:
TEST_P(ConvolutionQDqTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
@@ -175,7 +175,7 @@ const std::vector<ConvolutionQDqTransformationTestValues> testValues = {
{
{},
{ { 127.f }, ngraph::element::f32, { 6, 1, 1, 1 }, false, 1ul, element::i8, false,
{ ov::pass::DisableConstantFolding::get_type_info_static() } },
{ {ov::pass::DisableConstantFolding::get_type_info_static(), ov::pass::DisableConstantFolding()} } },
{}
},
{ std::vector<float>{ 100.f }, ngraph::element::i8},
@@ -351,7 +351,7 @@ const std::vector<ConvolutionQDqTransformationTestValues> testValues = {
{
{},
{ { 127.f }, ngraph::element::f32, { 6, 1, 1, 1 }, false, 1ul, element::i8, false,
{ ov::pass::DisableConstantFolding::get_type_info_static() } },
{ {ov::pass::DisableConstantFolding::get_type_info_static(), ov::pass::DisableConstantFolding()} } },
{}
},
{ std::vector<float>{ 2.f }, ngraph::element::i8},
@@ -420,7 +420,7 @@ const std::vector<ConvolutionQDqTransformationTestValues> testValues = {
{
{},
{ { 127.f }, ngraph::element::f32, { 6, 1, 1, 1 }, false, 1ul, element::i8, false,
{ ov::pass::DisableConstantFolding::get_type_info_static() } },
{ {ov::pass::DisableConstantFolding::get_type_info_static(), ov::pass::DisableConstantFolding()} } },
{}
},
{ std::vector<float>{ 2.f }, ngraph::element::i8},

View File

@@ -118,7 +118,7 @@ public:
TEST_P(ConvolutionTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -95,7 +95,7 @@ TEST_P(ConvolutionWithIncorrectWeightsTransformation, CompareFunctions) {
ngraph::pass::InitNodeInfo().run_on_model(actualFunction);
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true);
auto res = compare_functions(actualFunction, referenceFunction, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -100,7 +100,7 @@ public:
TEST_P(DepthToSpaceTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -97,7 +97,7 @@ public:
TEST_P(DisableConvertOnConstPathTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
}
@@ -146,13 +146,13 @@ const std::vector<DisableConvertOnConstPathTransformationValues> testValues = {
{
{ngraph::element::f32},
{ {128.f}, element::f32, {}, false, 1ul, element::u8, true, {},
{ov::pass::DisableConstantFolding::get_type_info_static() } },
{{ov::pass::DisableConstantFolding::get_type_info_static(), ov::pass::DisableConstantFolding()} } },
{ {0.02f}, element::f32, {}, false }
},
{
{ ngraph::element::f32, false },
{ {128.f}, element::f32, {}, false, 1ul, element::i8, true, {},
{ov::pass::DisableConstantFolding::get_type_info_static() } },
{{ov::pass::DisableConstantFolding::get_type_info_static(), ov::pass::DisableConstantFolding()} } },
{ {0.03f}, element::f32, {}, false }
},
{ std::vector<float>{ 1.f }, ngraph::element::f32},

View File

@@ -97,7 +97,7 @@ public:
TEST_P(ElementwiseWithMultiParentDequantizationTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -106,7 +106,7 @@ public:
TEST_P(FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, false, false);
auto res = compare_functions(actualFunction, referenceFunction, false, false);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -91,7 +91,7 @@ public:
TEST_P(FakeQuantizeOnWeightsWithUnsupportedChildTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -133,7 +133,7 @@ public:
TEST_P(FakeQuantizePrecisionSelectionTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -126,7 +126,7 @@ public:
TEST_P(FakeQuantizeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -127,7 +127,7 @@ public:
TEST_P(FakeQuantizeWithNotOptimalTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
}
@@ -200,7 +200,7 @@ const std::vector<FakeQuantizeWithNotOptimalTransformationTestValues> fakeQuanti
{},
{ std::vector<float>(64, 127.f), ngraph::element::f32,
{64, 1, 1, 1}, false, 1ul, ngraph::element::i8, false,
{ov::pass::DisableConstantFolding::get_type_info_static()}},
{{ov::pass::DisableConstantFolding::get_type_info_static(), ov::pass::DisableConstantFolding()}}},
{}
},
{

View File

@@ -139,7 +139,7 @@ private:
TEST_P(FakeQuantizeWithDynamicIntervalsTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -83,7 +83,7 @@ public:
TEST_P(FoldConvertTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -94,7 +94,7 @@ public:
TEST_P(FoldFakeQuantizeInTransformations, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, false);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -87,7 +87,7 @@ public:
TEST_P(FuseConvertTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -116,7 +116,7 @@ public:
TEST_P(FuseFakeQuantizeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -90,7 +90,7 @@ public:
TEST_P(FuseFakeQuantizeWithMultiInputsTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, false, true);
auto res = compare_functions(actualFunction, referenceFunction, false, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -101,7 +101,7 @@ public:
TEST_P(FuseMultiplyToFakeQuantizeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -134,7 +134,7 @@ public:
TEST_P(FuseSubtractToFakeQuantizeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -92,7 +92,7 @@ public:
TEST_P(GetDequantizationBelowTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -74,7 +74,7 @@ TEST_P(GetDequantizationTestTransformation, CompareFunctions) {
InitNodeInfo().run_on_model(actualFunction);
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true);
auto res = compare_functions(actualFunction, referenceFunction, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -128,7 +128,7 @@ public:
TEST_P(GroupConvolutionTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
@@ -470,7 +470,7 @@ const std::vector<GroupConvolutionTestValues> testValuesGroupConv = {
1,
ngraph::element::i8,
false,
{ov::pass::DisableConstantFolding::get_type_info_static()}
{{ov::pass::DisableConstantFolding::get_type_info_static(), ov::pass::DisableConstantFolding()}}
},
{}
},

View File

@@ -190,7 +190,7 @@ public:
TEST_P(InterpolateTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -152,7 +152,7 @@ TEST_P(MarkupAvgPoolPrecisionsTransformation, CompareFunctions) {
ASSERT_TRUE(checkIfAttributesAreTheSame<AvgPoolPrecisionPreservedAttribute>(precisionPreserved)) <<
"AvgPoolPrecisionPreservedAttribute are not the same";
//auto res = compare_functions(referenceFunction, actualFunction, true, true);
//auto res = compare_functions(actualFunction, referenceFunction, true, true);
//ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -134,7 +134,7 @@ public:
TEST_P(MatMulTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -144,7 +144,7 @@ public:
TEST_P(MatMulWithConstantTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -92,7 +92,7 @@ public:
TEST_P(MaxPoolTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, false, false);
auto res = compare_functions(actualFunction, referenceFunction, true, false, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -94,7 +94,7 @@ public:
TEST_P(MoveDequantizationAfterTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, false, true);
auto res = compare_functions(actualFunction, referenceFunction, true, false, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -221,7 +221,7 @@ public:
TEST_P(MoveFakeQuantizeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -104,7 +104,7 @@ public:
TEST_P(MultiplyToGroupConvolutionTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -76,7 +76,7 @@ public:
TEST_P(MultiplyTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -112,7 +112,7 @@ public:
TEST_P(MVNTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -76,7 +76,7 @@ public:
TEST_P(NormalizeDequantizationTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, false, true);
auto res = compare_functions(actualFunction, referenceFunction, true, false, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -104,7 +104,7 @@ public:
TEST_P(NormalizeL2Transformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -115,7 +115,7 @@ public:
TEST_P(PadTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -94,7 +94,7 @@ protected:
TEST_P(PReluTransformation, CompareFunctions) {
InitNodeInfo().run_on_model(actualFunction);
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -135,7 +135,7 @@ public:
TEST_P(PullReshapeThroughDequantizationTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -130,7 +130,7 @@ public:
TEST_P(PullTransposeThroughDequantizationTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -40,7 +40,7 @@ class ReduceMaxTransformation : public ReduceTransformation<opset1::ReduceMax> {
TEST_P(ReduceMaxTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -40,7 +40,7 @@ class ReduceMeanTransformation : public ReduceTransformation<opset1::ReduceMean>
TEST_P(ReduceMeanTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -40,7 +40,7 @@ class ReduceMinTransformation : public ReduceTransformation<opset1::ReduceMin> {
TEST_P(ReduceMinTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -40,7 +40,7 @@ class ReduceSumTransformation : public ReduceTransformation<opset1::ReduceSum> {
TEST_P(ReduceSumTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -94,7 +94,7 @@ protected:
TEST_P(ReluTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -91,7 +91,7 @@ public:
TEST_P(ReshapeTransformation, CompareFunctions) {
InitNodeInfo().run_on_model(actualFunction);
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -98,7 +98,7 @@ std::vector<RoundTestValues> testValues = {
TEST_P(RoundTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
}

View File

@@ -126,7 +126,7 @@ public:
TEST_P(SeparateInStandaloneBranchTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -93,7 +93,7 @@ public:
TEST_P(ShuffleChannelsTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -104,7 +104,7 @@ TEST_P(SplitTransformation, CompareFunctions) {
InitNodeInfo().run_on_model(actualFunction);
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -89,7 +89,7 @@ public:
TEST_P(SqueezeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -119,7 +119,7 @@ public:
TEST_P(StridedSliceTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -94,7 +94,7 @@ public:
TEST_P(TransposeTransformation, CompareFunctions) {
InitNodeInfo().run_on_model(actualFunction);
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
auto res = compare_functions(actualFunction, referenceFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -89,7 +89,7 @@ public:
TEST_P(UnsqueezeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -89,7 +89,7 @@ TEST_P(VariadicSplitTransformation, CompareFunctions) {
InitNodeInfo().run_on_model(actualFunction);
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, false);
auto res = compare_functions(actualFunction, referenceFunction, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";

View File

@@ -242,15 +242,12 @@ TEST_F(TransformationTestsF, TransposeFuses) {
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 1, 2, 640, 20, 2, 2 });
auto tr1_order = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{ 6 }, { 0, 5, 1, 2, 3, 4 });
auto transpose1 = std::make_shared<ngraph::opset6::Transpose>(input, tr1_order);
transpose1->set_friendly_name("transpose1");
auto tr2_order = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{ 6 }, { 0, 1, 3, 4, 2, 5 });
auto transpose2 = std::make_shared<ngraph::opset6::Transpose>(transpose1, tr2_order);
transpose2->set_friendly_name("transpose2");
auto add_const = ngraph::opset6::Constant::create(ngraph::element::f32, ngraph::Shape{ 1 }, { 1 });
auto add = std::make_shared<ngraph::opset6::Add>(transpose2, add_const);
add->set_friendly_name("add");
auto result = std::make_shared<ngraph::opset6::Result>(transpose2);
result->set_layout("NC...");
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{ add }, ngraph::ParameterVector{ input });
function = std::make_shared<ngraph::Function>(ngraph::ResultVector{ result }, ngraph::ParameterVector{ input });
manager.register_pass<ngraph::pass::TransposeFuse>();
}
@@ -258,12 +255,10 @@ TEST_F(TransformationTestsF, TransposeFuses) {
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{ 1, 2, 640, 20, 2, 2 });
auto tr_order = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{ 6 }, { 0, 5, 2, 3, 1, 4 });
auto transpose = std::make_shared<ngraph::opset6::Transpose>(input, tr_order);
transpose->set_friendly_name("transpose2");
auto add_const = ngraph::opset6::Constant::create(ngraph::element::f32, ngraph::Shape{ 1 }, { 1 });
auto add = std::make_shared<ngraph::opset6::Add>(transpose, add_const);
add->set_friendly_name("add");
auto result = std::make_shared<ngraph::opset6::Result>(transpose);
result->set_layout("NC...");
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{ add }, ngraph::ParameterVector{ input });
function_ref = std::make_shared<ngraph::Function>(ngraph::ResultVector{ result }, ngraph::ParameterVector{ input });
}
}

View File

@@ -297,7 +297,7 @@ TEST_P(ExecutableNetworkBaseTest, canExport) {
TEST_P(ExecutableNetworkBaseTest, pluginDoesNotChangeOriginalNetwork) {
// compare 2 networks
auto referenceNetwork = ngraph::builder::subgraph::makeConvPoolRelu();
compare_functions(referenceNetwork, cnnNet.getFunction());
compare_functions(cnnNet.getFunction(), referenceNetwork);
}
using ExecNetSetPrecision = BehaviorTestsUtils::BehaviorTestsBasic;

View File

@@ -331,7 +331,7 @@ TEST_P(OVExecutableNetworkBaseTest, canExport) {
TEST_P(OVExecutableNetworkBaseTest, pluginDoesNotChangeOriginalNetwork) {
// compare 2 networks
auto referenceNetwork = ngraph::builder::subgraph::makeConvPoolRelu();
compare_functions(referenceNetwork, function);
compare_functions(function, referenceNetwork);
}
TEST_P(OVExecutableNetworkBaseTest, getInputFromFunctionWithSingleInput) {

View File

@@ -34,6 +34,7 @@ public:
TransformationTestsF() : comparator(FunctionsComparator::no_default()) {
m_unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
comparator.enable(FunctionsComparator::CmpValues::PRECISIONS);
comparator.enable(FunctionsComparator::CmpValues::RUNTIME_KEYS);
// TODO: enable attributes and constant values comparison by default XXX-68694
// comparator.enable(FunctionsComparator::CmpValues::ATTRIBUTES);
// comparator.enable(FunctionsComparator::CmpValues::CONST_VALUES);

View File

@@ -43,8 +43,8 @@ public:
const size_t constantIndex = 1ul,
const ngraph::element::Type constantPrecision = ngraph::element::undefined,
const bool addConvert = false,
const std::vector<std::string>& attributes = {},
const std::vector<std::string>& convertAttributes = {});
const ov::Node::RTMap& attributes = {},
const ov::Node::RTMap& convertAttributes = {});
bool empty() const noexcept;
bool equal(const DequantizationOperations::Subtract& value) const noexcept;
bool operator==(const Subtract& value) const noexcept {
@@ -62,8 +62,8 @@ public:
size_t constantIndex = 1ul;
ngraph::element::Type constantPrecision = ngraph::element::undefined;
bool addConvert = false;
std::vector<std::string> attributes;
std::vector<std::string> convertAttributes;
ov::Node::RTMap attributes;
ov::Node::RTMap convertAttributes;
private:
bool isEmpty;

View File

@@ -63,8 +63,8 @@ std::shared_ptr<Node> makeDequantization(
dequantizationOperations.subtract.outPrecision);
auto& rt = subtractConstConvert->get_rt_info();
for (const std::string& attribute : dequantizationOperations.subtract.convertAttributes) {
rt[attribute] = "";
for (const auto& attribute : dequantizationOperations.subtract.convertAttributes) {
rt.insert(attribute);
}
subtractConst = subtractConstConvert;
@@ -104,8 +104,8 @@ std::shared_ptr<Node> makeDequantization(
if (!dequantizationOperations.subtract.attributes.empty()) {
auto& rt = subtract->get_rt_info();
for (const std::string& attribute : dequantizationOperations.subtract.attributes) {
rt[attribute] = "";
for (const auto& attribute : dequantizationOperations.subtract.attributes) {
rt.insert(attribute);
}
}

View File

@@ -64,8 +64,8 @@ DequantizationOperations::Subtract::Subtract(
const size_t constantIndex,
const ngraph::element::Type constantPrecision,
const bool addConvert,
const std::vector<std::string>& attributes,
const std::vector<std::string>& convertAttributes) :
const ov::Node::RTMap& attributes,
const ov::Node::RTMap& convertAttributes) :
isEmpty(false),
values(values),
outPrecision(outPrecision),