[LPT] Added check for uniqueness of friendly names in tests (#7570)

* FQDecomposition: added check on unique friendly names after transformation

* NormalizeL2Transformation: added check on unique friendly names after transformation

* ti to sequences conversion: naming fix

* [LPT][TESTS] Check on unique names added to functional tests

* compilation error fix

* compilation error fix
This commit is contained in:
Vladislav Golubev 2021-09-29 18:40:21 +03:00 committed by GitHub
parent 08897e4c80
commit 04158afc21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 123 additions and 134 deletions

View File

@ -170,7 +170,7 @@ DataPrecision getDataPrecisionByOutputPort(std::shared_ptr<opset1::FakeQuantize>
}
// TODO: LPT: refactor: use one way to decompose FakeQuantize
std::shared_ptr<ngraph::Node> decomposeFakeQuantize(
std::tuple<std::shared_ptr<Node>, std::shared_ptr<Node>> decomposeFakeQuantize(
MatcherPass* matcherPass,
std::shared_ptr<opset1::FakeQuantize>& layer,
const std::shared_ptr<IntervalsAlignmentAttribute>& intervalsAlignment,
@ -178,6 +178,8 @@ std::shared_ptr<ngraph::Node> decomposeFakeQuantize(
const bool updatePrecisions,
const element::Type deqPrecision) {
std::shared_ptr<ngraph::Node> dequantize;
std::shared_ptr<ngraph::Node> newFQ;
if (intervalsAlignment != nullptr) {
OV_ITT_SCOPE(FIRST_INFERENCE, itt::domains::LPT_LT, "decomposeFakeQuantize1");
const std::vector<float> outputLowValues = ov::as_type_ptr<opset1::Constant>(layer->get_input_node_shared_ptr(3))->cast_vector<float>();
@ -200,12 +202,12 @@ std::shared_ptr<ngraph::Node> decomposeFakeQuantize(
updatedOutputHighValue);
if ((updatePrecisions == false) && (dequantizationMul == 1.f) && (dequantizationSub == 0.f)) {
return nullptr;
std::make_tuple(nullptr, nullptr);
}
//TODO: pass min levels as a parameter?
if (levels < 2ul) {
return nullptr;
std::make_tuple(nullptr, nullptr);
}
// 2. update FakeQuantize - one time action
@ -240,6 +242,7 @@ std::shared_ptr<ngraph::Node> decomposeFakeQuantize(
NetworkHelper::copyInfo(sourceNodes, targetNodes);
dequantize = dequantization.multiply;
newFQ = newFakeQuantizeLayer;
} else {
OV_ITT_SCOPE(FIRST_INFERENCE, itt::domains::LPT_LT, "decomposeFakeQuantize2");
// Split FakeQuantize to two parts: Quantize and Dequantize
@ -253,13 +256,14 @@ std::shared_ptr<ngraph::Node> decomposeFakeQuantize(
const auto newFakeQuantize = std::get<0>(QDQ);
if (newFakeQuantize == nullptr) {
return nullptr;
std::make_tuple(nullptr, nullptr);
}
matcherPass->register_new_node(newFakeQuantize);
dequantize = std::get<1>(QDQ);
newFQ = newFakeQuantize;
}
return dequantize;
return std::make_tuple(dequantize, newFQ);
}
} // namespace fq_decomposition
@ -402,18 +406,21 @@ bool FakeQuantizeDecompositionTransformation::transform(TransformationContext& c
}
}
std::shared_ptr<ngraph::Node> dequantize = fq_decomposition::decomposeFakeQuantize(
auto QDQ = fq_decomposition::decomposeFakeQuantize(
this,
layer,
intervalsAlignment,
dataPrecision,
updatePrecisions,
deqPrecision);
if (dequantize == nullptr) {
std::shared_ptr<ngraph::Node> dequantize = std::get<0>(QDQ);
std::shared_ptr<ngraph::Node> newFakeQuantize = std::get<1>(QDQ);
if (dequantize == nullptr || newFakeQuantize == nullptr) {
return false;
}
updateOutput(context, dequantize, layer);
updateOutput(context, dequantize, newFakeQuantize);
if (precisionsAttribute->sharedValue->precisions.size() != 1ul) {
precisionsAttribute->sharedValue->precisions = { dataPrecision.precision };

View File

@ -143,7 +143,7 @@ bool NormalizeL2Transformation::transform(TransformationContext &context, ngraph
replace_node(normalize, newMultiply);
ngraph::copy_runtime_info({ normalize, newMultiply }, newMultiply);
updateOutput(context, newMultiply, normalize);
updateOutput(context, newMultiply, newNormalize);
return true;
}

View File

@ -170,8 +170,11 @@ ngraph::pass::ConvertTensorIteratorToLSTMSequence::ConvertTensorIteratorToLSTMSe
out = std::make_shared<ngraph::opset5::Transpose>(out, order);
}
auto out_0 = std::make_shared<ngraph::opset5::Squeeze>(out, axis_out);
out_0->set_friendly_name(ti->get_friendly_name() + ".0");
auto out_1 = std::make_shared<ngraph::opset5::Squeeze>(sequence->output(1), axis_out);
out_1->set_friendly_name(ti->get_friendly_name() + ".1");
auto out_2 = std::make_shared<ngraph::opset5::Squeeze>(sequence->output(2), axis_out);
out_2->set_friendly_name(ti->get_friendly_name() + ".2");
ngraph::NodeVector outputs = {out_0, out_1, out_2};
for (size_t i = 0; i < ordered_out_descs.size(); ++i) {
@ -321,6 +324,7 @@ ngraph::pass::ConvertTensorIteratorToRNNSequence::ConvertTensorIteratorToRNNSequ
auto axis_out = ngraph::opset5::Constant::create(ngraph::element::i64, ngraph::Shape{1}, {1});
auto out_1 = std::make_shared<ngraph::opset5::Squeeze>(sequence->output(1), axis_out);
out_1->set_friendly_name(ti->get_friendly_name() + ".1");
Output<Node> out = sequence->output(0);
if (slice_axis == 0) {
@ -328,6 +332,7 @@ ngraph::pass::ConvertTensorIteratorToRNNSequence::ConvertTensorIteratorToRNNSequ
out = std::make_shared<ngraph::opset5::Transpose>(out, order);
}
auto out_0 = std::make_shared<ngraph::opset5::Squeeze>(out, axis_out);
out_0->set_friendly_name(ti->get_friendly_name() + ".0");
ngraph::NodeVector outputs = {out_0, out_1};
for (size_t i = 0; i < ordered_out_descs.size(); ++i) {
@ -478,6 +483,7 @@ ngraph::pass::ConvertTensorIteratorToGRUSequence::ConvertTensorIteratorToGRUSequ
auto axis_out = ngraph::opset5::Constant::create(ngraph::element::i64, ngraph::Shape{1}, {1});
auto out_1 = std::make_shared<ngraph::opset5::Squeeze>(sequence->output(1), axis_out);
out_1->set_friendly_name(ti->get_friendly_name() + ".1");
Output<Node> out = sequence->output(0);
if (slice_axis == 0) {
@ -485,6 +491,7 @@ ngraph::pass::ConvertTensorIteratorToGRUSequence::ConvertTensorIteratorToGRUSequ
out = std::make_shared<ngraph::opset5::Transpose>(out, order);
}
auto out_0 = std::make_shared<ngraph::opset5::Squeeze>(out, axis_out);
out_0->set_friendly_name(ti->get_friendly_name() + ".0");
ngraph::NodeVector outputs = {out_0, out_1};
for (size_t i = 0; i < ordered_out_descs.size(); ++i) {

View File

@ -152,6 +152,8 @@ TEST_P(AddTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ngraph::element::Type> netPrecision = {

View File

@ -112,6 +112,8 @@ TEST_P(AvgPoolTransformation, CompareFunctions) {
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -112,6 +112,8 @@ TEST_P(AvgPoolWithChildTransformation, CompareFunctions) {
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ngraph::element::Type> precisions = {

View File

@ -98,6 +98,8 @@ TEST_P(ClampTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -230,6 +230,8 @@ TEST_P(ConcatTransformation, CompareFunctions) {
auto res = compare_functions(referenceFunction, actualFunction, true, true, false, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
ConcatTransformationTestValues testValues = std::get<2>(GetParam());
const auto actualFakeQuantizes = LayerTransformation::get<opset1::FakeQuantize>(actualFunction);
if (testValues.axis == 1) {

View File

@ -194,6 +194,8 @@ TEST_P(ConvolutionBackpropDataTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<element::Type> netPrecisions = {

View File

@ -101,6 +101,8 @@ TEST_P(ConvolutionQDqTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -120,6 +120,8 @@ TEST_P(ConvolutionTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -102,6 +102,8 @@ TEST_P(DepthToSpaceTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -54,18 +54,6 @@ public:
bool addNotPrecisionPreservedOperation;
};
inline std::ostream& operator<<(std::ostream& os, const std::vector<float>& values) {
os << "{ ";
for (size_t i = 0; i < values.size(); ++i) {
os << values[i];
if (i != (values.size() - 1ul)) {
os << ", ";
}
}
os << " }";
return os;
}
inline std::ostream& operator<<(std::ostream& out, const FakeQuantizeTransformationTestValues& testValue) {
return out << "_" << testValue.actual << "_" << testValue.expected;
}
@ -140,6 +128,8 @@ TEST_P(FakeQuantizeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -85,6 +85,8 @@ TEST_P(FoldConvertTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ngraph::PartialShape> inputShapes = {

View File

@ -89,6 +89,8 @@ TEST_P(FuseConvertTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -118,6 +118,8 @@ TEST_P(FuseFakeQuantizeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<FuseFakeQuantizeTransformationTestValues> testValues = {

View File

@ -103,6 +103,8 @@ TEST_P(FuseMultiplyToFakeQuantizeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
std::vector<size_t> quantizationLevels = { 256ul, 128ul };

View File

@ -136,6 +136,8 @@ TEST_P(FuseSubtractToFakeQuantizeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<size_t> quantizationLevels = { 256ul, 128ul };

View File

@ -130,6 +130,8 @@ TEST_P(GroupConvolutionTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -188,6 +188,14 @@ public:
}
};
TEST_P(InterpolateTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<InterpolateTransformationTestValues> testValues {
// opset1
// nearest mode - move dequantization
@ -583,12 +591,6 @@ const std::vector<InterpolateTransformationTestValues> testValues {
},
};
TEST_P(InterpolateTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
}
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
InterpolateTransformation,

View File

@ -136,6 +136,8 @@ TEST_P(MatMulTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ngraph::element::Type> precisions = {

View File

@ -146,6 +146,8 @@ TEST_P(MatMulWithConstantTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ngraph::element::Type> precisions = {

View File

@ -94,6 +94,8 @@ TEST_P(MaxPoolTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, false, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -96,6 +96,8 @@ TEST_P(MoveDequantizationAfterTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, false, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ngraph::Shape> inputShapes = {

View File

@ -239,6 +239,8 @@ TEST_P(MoveFakeQuantizeTransformation, CompareFunctions) {
auto res = compare_functions(referenceFunction, actualFunction, true, true, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
const auto actualFakeQuantizes = LayerTransformation::get<opset1::FakeQuantize>(actualFunction);
ASSERT_TRUE(checkIfOutputAttributesSharedValuesAreTheSame<std::shared_ptr<PrecisionsAttribute>>(actualFakeQuantizes)) <<
"PrecisionsAttribute are not the same";

View File

@ -106,6 +106,8 @@ TEST_P(MultiplyToGroupConvolutionTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<MultiplyToGroupConvolutionTransformationTestValues> testValues = {

View File

@ -78,6 +78,8 @@ TEST_P(MultiplyTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ngraph::element::Type> precisions = {

View File

@ -114,6 +114,8 @@ TEST_P(MVNTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ngraph::element::Type> precisions = {

View File

@ -106,6 +106,8 @@ TEST_P(NormalizeL2Transformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ngraph::element::Type> precisions = {

View File

@ -117,6 +117,8 @@ TEST_P(PadTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ngraph::PartialShape> inputShapes = {

View File

@ -96,6 +96,8 @@ TEST_P(PReluTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -42,6 +42,8 @@ TEST_P(ReduceMaxTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -42,6 +42,8 @@ TEST_P(ReduceMeanTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -42,6 +42,8 @@ TEST_P(ReduceMinTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -42,6 +42,8 @@ TEST_P(ReduceSumTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -96,6 +96,8 @@ TEST_P(ReluTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -78,6 +78,8 @@ TEST_P(ReshapeFullyConnectedTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
std::vector<ReshapeFullyConnectedTransformationTestValues> testValues = {

View File

@ -48,18 +48,6 @@ public:
Expected expected;
};
inline std::ostream& operator<<(std::ostream& os, const std::vector<int>& values) {
os << "{ ";
for (size_t i = 0; i < values.size(); ++i) {
os << values[i];
if (i != (values.size() - 1ul)) {
os << ", ";
}
}
os << " }";
return os;
}
class ReshapeTransformation : public LayerTransformation, public testing::WithParamInterface<ReshapeTransformationTestValues> {
public:
void SetUp() override {
@ -105,6 +93,8 @@ TEST_P(ReshapeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ReshapeTransformationTestValues> testValues = {

View File

@ -128,6 +128,8 @@ TEST_P(SeparateInStandaloneBranchTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ngraph::Shape> shapes = {

View File

@ -95,6 +95,8 @@ TEST_P(ShuffleChannelsTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {

View File

@ -46,18 +46,6 @@ public:
bool addUnsupportedConcat;
};
inline std::ostream& operator<<(std::ostream& os,
const std::vector<ngraph::builder::subgraph::DequantizationOperations>& values) {
os << "{ ";
for (size_t i = 0; i < values.size(); ++i) {
os << values[i];
if (i != (values.size() - 1ul)) {
os << ", ";
}
}
os << " }";
return os;
}
typedef std::tuple <
ngraph::element::Type,
@ -118,6 +106,8 @@ TEST_P(SplitTransformation, CompareFunctions) {
auto res = compare_functions(referenceFunction, actualFunction, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<ngraph::element::Type> precisions = {

View File

@ -24,18 +24,6 @@ using namespace ngraph::pass;
using ngraph::builder::subgraph::SqueezeFunction;
inline std::ostream& operator<<(std::ostream& os, const std::vector<float>& values) {
os << "{ ";
for (size_t i = 0; i < values.size(); ++i) {
os << values[i];
if (i != (values.size() - 1ul)) {
os << ", ";
}
}
os << " }";
return os;
}
class SqueezeTransformationTestValues {
public:
class Actual {
@ -103,6 +91,8 @@ TEST_P(SqueezeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<SqueezeTransformationTestValues> testValues = {

View File

@ -26,19 +26,6 @@ using namespace ngraph;
using namespace ngraph::pass;
using namespace ngraph::builder::subgraph;
inline std::ostream& operator<<(std::ostream& os, const std::vector<int64_t>& values) {
os << "{ ";
for (size_t i = 0; i < values.size(); ++i) {
os << values[i];
if (i != (values.size() - 1ul)) {
os << ", ";
}
}
os << " }";
return os;
}
class StridedSliceTransformationTestValues {
public:
class Actual {
@ -134,6 +121,8 @@ TEST_P(StridedSliceTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
StridedSliceTransformationTestValues::LayerParams channelSlice = {

View File

@ -51,18 +51,6 @@ typedef std::tuple<
TransposeTransformationTestValues
> TransposeTransformationParams;
inline std::ostream& operator<<(std::ostream& os, const std::vector<int>& values) {
os << "{ ";
for (size_t i = 0; i < values.size(); ++i) {
os << values[i];
if (i != (values.size() - 1ul)) {
os << ", ";
}
}
os << " }";
return os;
}
class TransposeTransformation : public LayerTransformation, public testing::WithParamInterface<TransposeTransformationParams> {
public:
void SetUp() override {
@ -103,6 +91,15 @@ public:
}
};
TEST_P(TransposeTransformation, CompareFunctions) {
InitNodeInfo().run_on_function(actualFunction);
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
namespace testValues1 {
const std::vector<ngraph::PartialShape> inputShapes4D = {
{ 1, 3, 16, 16 },
@ -188,13 +185,6 @@ const std::vector<TransposeTransformationTestValues> testValues = {
},
};
TEST_P(TransposeTransformation, CompareFunctions) {
InitNodeInfo().run_on_function(actualFunction);
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second;
}
INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
TransposeTransformation,

View File

@ -24,18 +24,6 @@ using namespace ngraph::pass;
using ngraph::builder::subgraph::UnsqueezeFunction;
inline std::ostream& operator<<(std::ostream& os, const std::vector<float>& values) {
os << "{ ";
for (size_t i = 0; i < values.size(); ++i) {
os << values[i];
if (i != (values.size() - 1ul)) {
os << ", ";
}
}
os << " }";
return os;
}
class UnsqueezeTransformationTestValues {
public:
class Actual {
@ -103,6 +91,8 @@ TEST_P(UnsqueezeTransformation, CompareFunctions) {
actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<UnsqueezeTransformationTestValues> testValues = {

View File

@ -45,32 +45,6 @@ public:
Expected expected;
};
inline std::ostream& operator<<(std::ostream& os,
const std::vector<ngraph::builder::subgraph::DequantizationOperations>& values) {
os << "{ ";
for (size_t i = 0; i < values.size(); ++i) {
os << values[i];
if (i != (values.size() - 1ul)) {
os << ", ";
}
}
os << " }";
return os;
}
inline std::ostream& operator<<(std::ostream& os,
const std::vector<size_t>& values) {
os << "{ ";
for (size_t i = 0; i < values.size(); ++i) {
os << values[i];
if (i != (values.size() - 1ul)) {
os << ", ";
}
}
os << " }";
return os;
}
class VariadicSplitTransformation : public LayerTransformation, public testing::WithParamInterface<VariadicSplitTransformationTestValues> {
public:
void SetUp() override {
@ -117,6 +91,8 @@ TEST_P(VariadicSplitTransformation, CompareFunctions) {
auto res = compare_functions(referenceFunction, actualFunction, true, false);
ASSERT_TRUE(res.first) << res.second;
ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}
const std::vector<VariadicSplitTransformationTestValues> testValues = {

View File

@ -96,11 +96,11 @@ std::shared_ptr<Node> makeDequantization(
ngraph::op::TemporaryReplaceOutputType(parent, element::f32).get());
}
subtract->set_friendly_name(data.get_node_shared_ptr()->get_friendly_name() + "/DequantizationSubtract");
ngraph::pass::low_precision::NetworkHelper::setOutDataPrecision(subtract, dequantizationOperations.subtract.outPrecision);
}
NetworkHelper::copyInfo({ data.get_node_shared_ptr(), subtract }, subtract);
subtract->set_friendly_name(data.get_node_shared_ptr()->get_friendly_name() + "/DequantizationSubtract");
if (!dequantizationOperations.subtract.attributes.empty()) {
auto& rt = subtract->get_rt_info();