[LPT] issue #37332: tests unification (#3277)

* [LPT] ieFuncTests unification

* [LPT] plugin tests unification

* [LPT] added removeStandaloneCleanup && removeTransforamtions refactoring
This commit is contained in:
Vladislav Golubev 2020-12-28 12:06:38 +03:00 committed by GitHub
parent eac33e1b0e
commit 5943e1be73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
169 changed files with 3062 additions and 1480 deletions

View File

@ -39,10 +39,98 @@ public:
void setUpdatePrecisions(const bool updatePrecisions); void setUpdatePrecisions(const bool updatePrecisions);
void setQuantizedTensorAlignmentOnActivations(const LayerTransformation::QuantizedTensorAlignment quantizedTensorAlignmentOnActivations); void setQuantizedTensorAlignmentOnActivations(const LayerTransformation::QuantizedTensorAlignment quantizedTensorAlignmentOnActivations);
void setQuantizedTensorAlignmentOnWeights(const LayerTransformation::QuantizedTensorAlignment quantizedTensorAlignmentOnWeights); void setQuantizedTensorAlignmentOnWeights(const LayerTransformation::QuantizedTensorAlignment quantizedTensorAlignmentOnWeights);
LowPrecisionTransformations& remove(const std::string& operationType);
LowPrecisionTransformations& removeBranchSpecificTransformations(const std::string& operationType); /**
LowPrecisionTransformations& removeTransformations(const std::string& operationType); * Remove branch specific transformation. Transformation type and operation type are required.
LowPrecisionTransformations& removeCleanupTransformations(const std::string& operationType); * Operation type is used to find transformation by operation during precision definition.
*/
template <class Transformation, class Operation>
LowPrecisionTransformations& removeBranchSpecific() {
const std::string operationType = getType<Operation>();
const std::string transformationType = typeid(Transformation).name();
for (auto it = branchSpecificTransformations.begin(); it != branchSpecificTransformations.end(); ++it) {
const auto& tranformationPtr = *it->second;
if ((it->first == operationType) && (typeid(tranformationPtr).name() == transformationType)) {
branchSpecificTransformations.erase(it);
break;
}
}
return *this;
}
/**
* Remove transformation. Transformation type and operation type are required.
* Operation type is used to find transformation by operation during precision definition.
*/
template <class Transformation, class Operation>
LowPrecisionTransformations& remove() {
const std::string operationType = getType<Operation>();
const std::string transformationType = typeid(Transformation).name();
for (auto it = transformations.begin(); it != transformations.end(); ++it) {
const auto& tranformationPtr = *it->second;
if ((it->first == operationType) && (typeid(tranformationPtr).name() == transformationType)) {
transformations.erase(it);
break;
}
}
return *this;
}
/**
* Remove cleanup transformation. Transformation type and operation type are required.
* Operation type is used to find transformation by operation during precision definition.
*/
template <class Transformation, class Operation>
LowPrecisionTransformations& removeCleanup() {
const std::string operationType = getType<Operation>();
const std::string transformationType = typeid(Transformation).name();
const auto it = cleanupTransformations.find(operationType);
if (it != cleanupTransformations.end()) {
const auto it1 = std::find_if(it->second.begin(), it->second.end(),
[&](const std::pair<std::string, LayerTransformationPtr>& transformation) {
return transformation.first == transformationType;
});
if (it1 != it->second.end()) {
it->second.erase(it1);
if (it->second.empty()) {
cleanupTransformations.erase(it);
}
}
}
return *this;
}
/**
* Remove standalone cleanup transformation. Transformation type and operation type are required.
* Operation type is used to find transformation by operation during precision definition.
*/
template <class Transformation, class Operation>
LowPrecisionTransformations& removeStandaloneCleanup() {
const std::string operationType = getType<Operation>();
const std::string transformationType = typeid(Transformation).name();
for (auto it = standaloneCleanupTransformations.begin(); it != standaloneCleanupTransformations.end(); ++it) {
const auto& standaloneCleanup = *it;
if ((operationType == standaloneCleanup.typeName) && (transformationType == standaloneCleanup.typeId)) {
standaloneCleanupTransformations.erase(it);
break;
}
}
return *this;
}
template <class Transformation, class Operation>
LowPrecisionTransformations& removeAll() {
removeBranchSpecific<Transformation, Operation>();
remove<Transformation, Operation>();
removeCleanup<Transformation, Operation>();
removeStandaloneCleanup<Transformation, Operation>();
return *this;
}
/** /**
* Add branch specific transformation. Transformation type and operation type are required. * Add branch specific transformation. Transformation type and operation type are required.

View File

@ -290,7 +290,9 @@ void ConcatTransformation::addDequantizationLayers(
for (size_t i = 0; i < layerDequantizations.size(); ++i) { for (size_t i = 0; i < layerDequantizations.size(); ++i) {
const auto& dequantization = layerDequantizations[i]; const auto& dequantization = layerDequantizations[i];
convertNodes.push_back(dequantization.convert); if (dequantization.convert != nullptr) {
convertNodes.push_back(dequantization.convert);
}
const ngraph::element::Type precision = dequantization.data.get_element_type(); const ngraph::element::Type precision = dequantization.data.get_element_type();
ngraph::Shape targetShape = dequantization.data.get_shape(); ngraph::Shape targetShape = dequantization.data.get_shape();

View File

@ -678,9 +678,10 @@ FakeQuantizeDequantization NetworkHelper::makeDequantization(
const std::shared_ptr<opset1::Parameter> input = std::make_shared<ngraph::opset1::Parameter>(precision, dataNodeOutputShape); const std::shared_ptr<opset1::Parameter> input = std::make_shared<ngraph::opset1::Parameter>(precision, dataNodeOutputShape);
std::shared_ptr<ngraph::Node> parent = input; std::shared_ptr<ngraph::Node> parent = input;
// TODO: convert should be optional: where is updatePrecision?
std::shared_ptr<DequantizationConvert> convert; std::shared_ptr<DequantizationConvert> convert;
{ if (precision == originalPrecision) {
convert = nullptr;
} else {
convert = std::make_shared<DequantizationConvert>( convert = std::make_shared<DequantizationConvert>(
input, input,
originalPrecision); originalPrecision);
@ -742,21 +743,28 @@ FakeQuantizeDequantization NetworkHelper::createDequantizationFromFakeQuantize(
} }
} }
const auto input = std::make_shared<ngraph::opset1::Parameter>(precision, fq->get_output_shape(0)); const auto input = std::make_shared<ngraph::opset1::Parameter>(
const std::shared_ptr<ngraph::opset1::Convert> convert = std::make_shared<DequantizationConvert>( updatePrecision ? precision : fq->get_output_element_type(0),
input, fq->get_output_shape(0));
fq->get_output_element_type(0)); std::shared_ptr<ngraph::Node> parent = input;
const std::shared_ptr<ngraph::opset1::Subtract> subtract = shift == nullptr ? std::shared_ptr<ngraph::opset1::Convert> convert;
nullptr : if (updatePrecision) {
make_shared<ngraph::op::TypeRelaxed<DequantizationSubtract>>(convert, shift); convert = std::make_shared<DequantizationConvert>(parent, fq->get_output_element_type(0));
if (subtract != nullptr) { parent = convert;
subtract->set_output_type(0, fq->get_output_element_type(0), subtract->get_output_partial_shape(0)); } else {
convert = nullptr;
} }
const std::shared_ptr<ngraph::opset1::Multiply> multiply = std::make_shared<DequantizationMultiply>( std::shared_ptr<ngraph::opset1::Subtract> subtract;
subtract == nullptr ? static_cast<std::shared_ptr<Node>>(convert) : subtract, if (shift != nullptr) {
scale); subtract = make_shared<ngraph::op::TypeRelaxed<DequantizationSubtract>>(parent, shift);
subtract->set_output_type(0, fq->get_output_element_type(0), subtract->get_output_partial_shape(0));
parent = subtract;
} else {
subtract = nullptr;
}
const std::shared_ptr<ngraph::opset1::Multiply> multiply = std::make_shared<DequantizationMultiply>(parent, scale);
return FakeQuantizeDequantization(fq, convert, subtract, multiply); return FakeQuantizeDequantization(fq, convert, subtract, multiply);
} }

View File

@ -101,28 +101,6 @@ void LowPrecisionTransformations::setQuantizedTensorAlignmentOnWeights(
} }
} }
LowPrecisionTransformations& LowPrecisionTransformations::remove(const std::string& operationType) {
removeBranchSpecificTransformations(operationType);
removeTransformations(operationType);
removeCleanupTransformations(operationType);
return *this;
}
LowPrecisionTransformations& LowPrecisionTransformations::removeBranchSpecificTransformations(const std::string& operationType) {
branchSpecificTransformations.erase(operationType);
return *this;
}
LowPrecisionTransformations& LowPrecisionTransformations::removeTransformations(const std::string& operationType) {
transformations.erase(operationType);
return *this;
}
LowPrecisionTransformations& LowPrecisionTransformations::removeCleanupTransformations(const std::string& operationType) {
cleanupTransformations.erase(operationType);
return *this;
}
std::vector<LayerTransformationPtr> LowPrecisionTransformations::find(const std::string& transformationKey) const { std::vector<LayerTransformationPtr> LowPrecisionTransformations::find(const std::string& transformationKey) const {
auto it = branchSpecificTransformations.find(transformationKey); auto it = branchSpecificTransformations.find(transformationKey);
std::vector<LayerTransformationPtr> res; std::vector<LayerTransformationPtr> res;

View File

@ -18,19 +18,34 @@
#include "common_test_utils/ngraph_test_utils.hpp" #include "common_test_utils/ngraph_test_utils.hpp"
#include "simple_low_precision_transformer.hpp" #include "simple_low_precision_transformer.hpp"
#include "lpt_ngraph_functions/avg_pool_function.hpp" #include "lpt_ngraph_functions/avg_pool_function.hpp"
#include "lpt_ngraph_functions/common/dequantization_operations.hpp"
using namespace testing; using namespace testing;
using namespace ngraph::pass; using namespace ngraph::pass;
class AvgPoolTransformationTestValues { class AvgPoolTransformationTestValues {
public: public:
low_precision::LayerTransformation::Params params; public:
std::vector<float> subtractValues; class Actual {
std::vector<float> mutliplyValues; public:
ngraph::element::Type inputPrecision;
ngraph::builder::subgraph::DequantizationOperations dequantization;
};
class Expected {
public:
ngraph::element::Type inputPrecision;
ngraph::builder::subgraph::DequantizationOperations dequantizationBefore;
ngraph::element::Type preicsionAfterOperation;
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter;
};
ngraph::pass::low_precision::LayerTransformation::Params params;
Actual actual;
Expected expected;
}; };
typedef std::tuple< typedef std::tuple<
ngraph::element::Type,
ngraph::Shape, ngraph::Shape,
bool, // additional FakeQuantize After bool, // additional FakeQuantize After
std::string, // additional layer before FQ std::string, // additional layer before FQ
@ -39,22 +54,17 @@ typedef std::tuple<
class AvgPoolTransformation : public LayerTransformation, public testing::WithParamInterface<AvgPoolTransformationParams> { class AvgPoolTransformation : public LayerTransformation, public testing::WithParamInterface<AvgPoolTransformationParams> {
public: public:
void SetUp() override { void SetUp() override {
const ngraph::element::Type precision = std::get<0>(GetParam()); const ngraph::Shape shape = std::get<0>(GetParam());
const ngraph::Shape shape = std::get<1>(GetParam()); const bool addFakeQuantize = std::get<1>(GetParam());
const bool addFQ = std::get<2>(GetParam()); const std::string additionalLayer = std::get<2>(GetParam());
const std::string additionalLayer = std::get<3>(GetParam()); const AvgPoolTransformationTestValues testValues = std::get<3>(GetParam());
const AvgPoolTransformationTestValues testValues = std::get<4>(GetParam());
actualFunction = ngraph::builder::subgraph::AvgPoolFunction::getOriginal( actualFunction = ngraph::builder::subgraph::AvgPoolFunction::getOriginal(
precision, testValues.actual.inputPrecision,
shape, shape,
addFQ, addFakeQuantize,
additionalLayer, additionalLayer,
{ testValues.actual.dequantization);
testValues.params.updatePrecisions ? testValues.params.precisionsOnActivations[0] : precision,
testValues.subtractValues,
testValues.mutliplyValues
});
SimpleLowPrecisionTransformer transform; SimpleLowPrecisionTransformer transform;
transform.add<ngraph::pass::low_precision::AvgPoolTransformation, ngraph::opset1::AvgPool>(testValues.params); transform.add<ngraph::pass::low_precision::AvgPoolTransformation, ngraph::opset1::AvgPool>(testValues.params);
@ -62,25 +72,31 @@ public:
transform.transform(actualFunction); transform.transform(actualFunction);
referenceFunction = ngraph::builder::subgraph::AvgPoolFunction::getReference( referenceFunction = ngraph::builder::subgraph::AvgPoolFunction::getReference(
precision, testValues.expected.inputPrecision,
shape, shape,
addFQ, addFakeQuantize,
additionalLayer, additionalLayer,
{ testValues.expected.dequantizationBefore,
testValues.params.updatePrecisions ? testValues.params.precisionsOnActivations[0] : precision, testValues.expected.preicsionAfterOperation,
testValues.subtractValues, testValues.expected.dequantizationAfter);
testValues.mutliplyValues
});
} }
static std::string getTestCaseName(testing::TestParamInfo<AvgPoolTransformationParams> obj) { static std::string getTestCaseName(testing::TestParamInfo<AvgPoolTransformationParams> obj) {
const ngraph::element::Type precision = std::get<0>(obj.param); const ngraph::Shape shape = std::get<0>(obj.param);
const ngraph::Shape shape = std::get<1>(obj.param); const bool addFakeQuantize = std::get<1>(obj.param);
const bool addFQ = std::get<2>(obj.param); const std::string additionalLayer = std::get<2>(obj.param);
const std::string additionalLayer = std::get<3>(obj.param); const AvgPoolTransformationTestValues testValues = std::get<3>(obj.param);
const AvgPoolTransformationTestValues testValues = std::get<4>(obj.param);
return LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) +
(addFQ ? "_FQ_after_" : "_") + (additionalLayer); std::ostringstream result;
result <<
LayerTransformation::getTestCaseNameByParams(testValues.actual.inputPrecision, shape, testValues.params) << "_" <<
testValues.actual.dequantization << "_" <<
testValues.expected.dequantizationBefore << "_" <<
testValues.expected.preicsionAfterOperation << "_" <<
testValues.expected.dequantizationAfter << "_" <<
(addFakeQuantize ? "_FQ_after_" : "_") << additionalLayer;
return result.str();
} }
}; };
@ -92,11 +108,6 @@ TEST_P(AvgPoolTransformation, CompareFunctions) {
ASSERT_TRUE(res.first) << res.second; ASSERT_TRUE(res.first) << res.second;
} }
const std::vector<ngraph::element::Type> precisions = {
ngraph::element::f32,
// ngraph::element::f16
};
const std::vector<std::string> additionalLayer = { const std::vector<std::string> additionalLayer = {
"", "",
// issue #40768 // issue #40768
@ -110,20 +121,216 @@ const std::vector<bool> addFQ = {
}; };
const std::vector<ngraph::Shape> shapes = { const std::vector<ngraph::Shape> shapes = {
{ 1, 32, 72, 48 } { 1, 3, 72, 48 }
}; };
const std::vector<AvgPoolTransformationTestValues> testValues = { const std::vector<AvgPoolTransformationTestValues> testValues = {
{ LayerTransformation::createParamsU8I8(), { 128 }, { 0.02f } }, // U8 per tensor quantization
{ LayerTransformation::createParamsU8I8().setUpdatePrecisions(false), { 128 }, { 0.02f } }, {
{ LayerTransformation::createParamsI8I8(), { 128 }, { 0.02f } }, LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {128.f}, {0.02f}}
},
{
ngraph::element::u8,
{},
ngraph::element::f32,
{{}, {128.f}, {0.02f}}
}
},
// U8 without subtract
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {0.02f}}
},
{
ngraph::element::u8,
{},
ngraph::element::f32,
{{}, {}, {0.02f}}
}
},
// U8 per channel quantization with different values
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{
{ngraph::element::f32},
{{128.f, 0.f, 128.f / 2}},
{{3.f, 1.f, 2.f}}
}
},
{
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::f32,
{
{},
{{128.f, 0.f, 128.f / 2}},
{{3.f, 1.f, 2.f}}
},
}
},
// U8 per channel quantization with the same values
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{
{ngraph::element::f32},
{{128.f, 128.f, 128.f}},
{{3.f, 3.f, 3.f}}
}
},
{
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::f32,
{
{},
{{128.f, 128.f, 128.f}},
{{3.f, 3.f, 3.f}}
},
}
},
// U8 without dequantization
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{}
},
{
ngraph::element::u8,
{},
ngraph::element::u8,
{}
}
},
// U8 not update precisions
{
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
{
ngraph::element::f32,
{{}, {128.f}, {0.02f}}
},
{
ngraph::element::f32,
{},
ngraph::element::f32,
{{}, {128.f}, {0.02f}}
}
},
// I8 per tensor quantization
{
LayerTransformation::createParamsI8I8(),
{
ngraph::element::i8,
{{ngraph::element::f32}, {128.f}, {0.02f}}
},
{
ngraph::element::i8,
{},
ngraph::element::f32,
{{}, {128.f}, {0.02f}}
}
},
// I8 without subtract
{
LayerTransformation::createParamsI8I8(),
{
ngraph::element::i8,
{{ngraph::element::f32}, {}, {0.02f}}
},
{
ngraph::element::i8,
{},
ngraph::element::f32,
{{}, {}, {0.02f}}
}
},
// I8 per channel quantization with different values
{
LayerTransformation::createParamsI8I8(),
{
ngraph::element::i8,
{
{ngraph::element::f32},
{{64.f, 0.f, 32.f}},
{{3.f, 1.f, 2.f}}
}
},
{
ngraph::element::i8,
{{}, {}, {}},
ngraph::element::f32,
{
{},
{{64.f, 0.f, 32.f}},
{{3.f, 1.f, 2.f}}
},
}
},
// I8 per channel quantization with the same values
{
LayerTransformation::createParamsI8I8(),
{
ngraph::element::i8,
{
{ngraph::element::f32},
{{64.f, 64.f, 64.f}},
{{3.f, 3.f, 3.f}}
}
},
{
ngraph::element::i8,
{{}, {}, {}},
ngraph::element::f32,
{
{},
{{64.f, 64.f, 64.f}},
{{3.f, 3.f, 3.f}}
},
}
},
// I8 without dequantization
{
LayerTransformation::createParamsI8I8(),
{
ngraph::element::i8,
{}
},
{
ngraph::element::i8,
{},
ngraph::element::i8,
{}
}
},
// I8 not update precisions
{
LayerTransformation::createParamsI8I8().setUpdatePrecisions(false),
{
ngraph::element::f32,
{{}, {128.f}, {0.02f}}
},
{
ngraph::element::f32,
{},
ngraph::element::f32,
{{}, {128.f}, {0.02f}}
}
},
}; };
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
smoke_LPT, smoke_LPT,
AvgPoolTransformation, AvgPoolTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions),
::testing::ValuesIn(shapes), ::testing::ValuesIn(shapes),
::testing::ValuesIn(addFQ), ::testing::ValuesIn(addFQ),
::testing::ValuesIn(additionalLayer), ::testing::ValuesIn(additionalLayer),

View File

@ -42,12 +42,17 @@ class ResultValues {
public: public:
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1;
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2;
ngraph::builder::subgraph::DequantizationOperations dequantization1; ngraph::element::Type precisionBeforeOp;
ngraph::builder::subgraph::DequantizationOperations dequantization2; ngraph::builder::subgraph::DequantizationOperations dequantizationBefore1;
ngraph::builder::subgraph::DequantizationOperations dequantizationBefore2;
ngraph::element::Type precisionAfterOperation;
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter1;
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter2;
}; };
inline std::ostream& operator<<(std::ostream& out, const ResultValues& values) { inline std::ostream& operator<<(std::ostream& out, const ResultValues& values) {
return out << "_" << values.fakeQuantize1 << "_" << values.fakeQuantize2 << "_" << values.dequantization1 << "_" << values.dequantization2; return out << "_" << values.fakeQuantize1 << "_" << values.fakeQuantize2 << "_"
<< values.dequantizationAfter1 << "_" << values.dequantizationAfter2;
} }
class TestValues { class TestValues {
@ -65,7 +70,6 @@ inline std::ostream& operator<<(std::ostream& out, const TestValues& values) {
typedef std::tuple < typedef std::tuple <
ngraph::element::Type, ngraph::element::Type,
bool,
TestValues TestValues
> ConcatTransformationParams; > ConcatTransformationParams;
@ -73,14 +77,7 @@ class ConcatSelectionWithIntermediateTransformation : public LayerTransformation
public: public:
void SetUp() override { void SetUp() override {
const ngraph::element::Type precision = std::get<0>(GetParam()); const ngraph::element::Type precision = std::get<0>(GetParam());
const bool updatePrecisions = std::get<1>(GetParam()); TestValues testValues = std::get<1>(GetParam());
TestValues testValues = std::get<2>(GetParam());
testValues.params.updatePrecisions = updatePrecisions;
if (!updatePrecisions) {
testValues.result.fakeQuantize1.outputPrecision = testValues.actual.fakeQuantize1.outputPrecision;
testValues.result.fakeQuantize2.outputPrecision = testValues.actual.fakeQuantize2.outputPrecision;
}
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalSelectionWithIntermediate( actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalSelectionWithIntermediate(
precision, precision,
@ -100,14 +97,17 @@ public:
testValues.transparentIntermediate, testValues.transparentIntermediate,
testValues.result.fakeQuantize1, testValues.result.fakeQuantize1,
testValues.result.fakeQuantize2, testValues.result.fakeQuantize2,
testValues.result.dequantization1, testValues.result.precisionBeforeOp,
testValues.result.dequantization2); testValues.result.dequantizationBefore1,
testValues.result.dequantizationBefore2,
testValues.result.precisionAfterOperation,
testValues.result.dequantizationAfter1,
testValues.result.dequantizationAfter2);
} }
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) { static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
const ngraph::element::Type precision = std::get<0>(obj.param); const ngraph::element::Type precision = std::get<0>(obj.param);
const bool updatePrecision = std::get<1>(obj.param); const TestValues testValues = std::get<1>(obj.param);
const TestValues testValues = std::get<2>(obj.param);
std::ostringstream result; std::ostringstream result;
result << result <<
@ -120,8 +120,6 @@ public:
}; };
TEST_P(ConcatSelectionWithIntermediateTransformation, CompareFunctions) { TEST_P(ConcatSelectionWithIntermediateTransformation, CompareFunctions) {
const TestValues testValues = std::get<2>(GetParam());
actualFunction->validate_nodes_and_infer_types(); actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true); auto res = compare_functions(referenceFunction, actualFunction, true, true);
ASSERT_TRUE(res.first) << res.second; ASSERT_TRUE(res.first) << res.second;
@ -132,8 +130,6 @@ const std::vector<ngraph::element::Type> precisions = {
// ngraph::element::f16 // ngraph::element::f16
}; };
const std::vector<bool> updatePrecisions = { true, false };
const std::vector<TestValues> testValues = { const std::vector<TestValues> testValues = {
// U8: Concat + MaxPool // U8: Concat + MaxPool
{ {
@ -142,23 +138,46 @@ const std::vector<TestValues> testValues = {
true, true,
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} } { 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {255.f} },
{ ngraph::element::f32, {}, { 0.01f } }, ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.01f } } {{}, {}, {}},
{{}, {}, {}},
ngraph::element::u8,
{ {ngraph::element::f32}, {}, { {0.01f, 0.01f, 0.01f, 0.1f, 0.1f, 0.1f} } },
{ {ngraph::element::f32}, {}, { 0.1f } }
}
},
// not update precisions
{
Shape{ 1, 3, 9, 9 },
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
true,
{
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }
},
{
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {255.f} },
ngraph::element::f32,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::f32,
{ {}, {}, { {0.01f, 0.01f, 0.01f, 0.1f, 0.1f, 0.1f} } },
{ {}, {}, { 0.1f } }
} }
} }
}; };
// INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
// DISABLED_LPT, smoke_LPT,
// ConcatSelectionWithIntermediateTransformation, ConcatSelectionWithIntermediateTransformation,
// ::testing::Combine( ::testing::Combine(
// ::testing::ValuesIn(precisions), ::testing::ValuesIn(precisions),
// ::testing::ValuesIn(updatePrecisions), ::testing::ValuesIn(testValues)),
// ::testing::ValuesIn(testValues)), ConcatSelectionWithIntermediateTransformation::getTestCaseName);
// ConcatSelectionWithIntermediateTransformation::getTestCaseName);
} // namespace } // namespace

View File

@ -41,11 +41,14 @@ class ConcatTransformationResultValues {
public: public:
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize1; ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize1;
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize2; ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize2;
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations; ngraph::element::Type precisionBeforeOp;
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations1;
ngraph::element::Type precisionAfterOperation;
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations2;
}; };
inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationResultValues& values) { inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationResultValues& values) {
return out << "_" << values.fakeQuantize1 << "_" << values.fakeQuantize2 << "_" << values.dequantizationOperations; return out << "_" << values.fakeQuantize1 << "_" << values.fakeQuantize2 << "_" << values.dequantizationOperations2;
} }
class ConcatTransformationTestValues { class ConcatTransformationTestValues {
@ -62,7 +65,6 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationTes
typedef std::tuple < typedef std::tuple <
ngraph::element::Type, ngraph::element::Type,
bool,
ngraph::Shape, ngraph::Shape,
ConcatTransformationTestValues ConcatTransformationTestValues
> ConcatTransformationParams; > ConcatTransformationParams;
@ -71,15 +73,8 @@ class ConcatTransformation : public LayerTransformation, public testing::WithPar
public: public:
void SetUp() override { void SetUp() override {
const ngraph::element::Type precision = std::get<0>(GetParam()); const ngraph::element::Type precision = std::get<0>(GetParam());
const bool updatePrecisions = std::get<1>(GetParam()); const ngraph::Shape shape = std::get<1>(GetParam());
const ngraph::Shape shape = std::get<2>(GetParam()); ConcatTransformationTestValues testValues = std::get<2>(GetParam());
ConcatTransformationTestValues testValues = std::get<3>(GetParam());
testValues.params.updatePrecisions = updatePrecisions;
if (!updatePrecisions) {
testValues.result.fakeQuantize1.outputPrecision = testValues.actual.fakeQuantize1.outputPrecision;
testValues.result.fakeQuantize2.outputPrecision = testValues.actual.fakeQuantize2.outputPrecision;
}
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginal( actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginal(
precision, precision,
@ -100,20 +95,21 @@ public:
shape, shape,
testValues.result.fakeQuantize1, testValues.result.fakeQuantize1,
testValues.result.fakeQuantize2, testValues.result.fakeQuantize2,
testValues.result.dequantizationOperations); testValues.result.precisionBeforeOp,
testValues.result.dequantizationOperations1,
testValues.result.precisionAfterOperation,
testValues.result.dequantizationOperations2);
} }
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) { static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
const ngraph::element::Type precision = std::get<0>(obj.param); const ngraph::element::Type precision = std::get<0>(obj.param);
const bool updatePrecision = std::get<1>(obj.param); const ngraph::Shape shape = std::get<1>(obj.param);
const ngraph::Shape shape = std::get<2>(obj.param); const ConcatTransformationTestValues testValues = std::get<2>(obj.param);
const ConcatTransformationTestValues testValues = std::get<3>(obj.param);
std::ostringstream result; std::ostringstream result;
result << result <<
LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_" << LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_" <<
(testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") << (testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") <<
(updatePrecision ? "updatePrecision_" : "notUpdatePrecision_") <<
testValues.actual << "_" << testValues.actual << "_" <<
testValues.result << "_"; testValues.result << "_";
return result.str(); return result.str();
@ -131,8 +127,6 @@ const std::vector<ngraph::element::Type> precisions = {
// ngraph::element::f16 // ngraph::element::f16
}; };
const std::vector<bool> updatePrecisions = { true, false };
const std::vector<ConcatTransformationTestValues> testValues = { const std::vector<ConcatTransformationTestValues> testValues = {
// U8: concat // U8: concat
{ {
@ -143,9 +137,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {2.55f} } { 256ul, {}, {0.f}, {2.55f}, {0.f}, {2.55f} }
}, },
{ {
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ ngraph::element::f32, {}, { 0.01f } } ngraph::element::u8,
{ {}, {}, {} },
ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.01f } },
} }
}, },
// U8: concat // U8: concat
@ -157,8 +154,11 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, {{1}, {1}, {1}, {1}}, {0.f}, {2.55f}, {0.f}, {2.55f} } { 256ul, {{1}, {1}, {1}, {1}}, {0.f}, {2.55f}, {0.f}, {2.55f} }
}, },
{ {
{ 256ul, {{1}, {1}, {}, {}}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {{1}, {1}, {}, {}}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, {{1}, {1}, {}, {}}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {{1}, {1}, {}, {}}, {0.f}, {2.55f}, {0.f}, {255.f} },
ngraph::element::u8,
{ {}, {}, {} },
ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
}, },
@ -171,8 +171,11 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, {{1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}}, {0.f}, {2.55f}, {0.f}, {2.55f} } { 256ul, {{1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}}, {0.f}, {2.55f}, {0.f}, {2.55f} }
}, },
{ {
{ 256ul, {{1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {{1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, {{1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {{1, 1, 1, 1}, {1, 1, 1, 1}, {}, {}}, {0.f}, {2.55f}, {0.f}, {255.f} },
ngraph::element::u8,
{ {}, {}, {} },
ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
}, },
@ -185,8 +188,11 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, {}, {0.f}, {1.275f}, {0.f}, {1.275f} } { 256ul, {}, {0.f}, {1.275f}, {0.f}, {1.275f} }
}, },
{ {
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, {}, {0.f}, {1.275f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {0.f}, {1.275f}, {0.f}, {255.f} },
ngraph::element::u8,
{ {}, {}, {} },
ngraph::element::u8,
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} } { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }
} }
}, },
@ -199,8 +205,11 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, {{1}, {1}, {1}, {1}}, {0.f}, {1.275f}, {0.f}, {1.275f} } { 256ul, {{1}, {1}, {1}, {1}}, {0.f}, {1.275f}, {0.f}, {1.275f} }
}, },
{ {
{ 256ul, {{1}, {1}, {}, {}}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {{1}, {1}, {}, {}}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, {{1}, {1}, {}, {}}, {0.f}, {1.275f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {{1}, {1}, {}, {}}, {0.f}, {1.275f}, {0.f}, {255.f} },
ngraph::element::u8,
{ {}, {}, {} },
ngraph::element::u8,
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} } { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }
} }
}, },
@ -235,6 +244,9 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{0.f, 0.f, 0.f}, {1.275f, 1.275f, 1.275f}, {0.f}, {255.f}, {0.f, 0.f, 0.f}, {1.275f, 1.275f, 1.275f}, {0.f}, {255.f},
ngraph::element::u8 ngraph::element::u8
}, },
ngraph::element::u8,
{ {}, {}, {} },
ngraph::element::u8,
{ ngraph::element::f32, {}, {{ 0.01f / 1.f, 0.01f / 2.f, 0.01f / 3.f, 0.005f / 1.f, 0.005f / 2.f, 0.005f / 3.f }} } { ngraph::element::f32, {}, {{ 0.01f / 1.f, 0.01f / 2.f, 0.01f / 3.f, 0.005f / 1.f, 0.005f / 2.f, 0.005f / 3.f }} }
} }
}, },
@ -247,8 +259,11 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, {}, {1.275f}, {2.55f}, {1.275f}, {2.55f} } { 256ul, {}, {1.275f}, {2.55f}, {1.275f}, {2.55f} }
}, },
{ {
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, {}, {1.275f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {1.275f}, {2.55f}, {0.f}, {255.f} },
ngraph::element::u8,
{ {}, {}, {} },
ngraph::element::u8,
{ {
ngraph::element::f32, ngraph::element::f32,
{{ 0.f, 0.f, 0.f, -255.f, -255.f, -255.f }}, {{ 0.f, 0.f, 0.f, -255.f, -255.f, -255.f }},
@ -265,8 +280,11 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, {}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f} } { 256ul, {}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }
}, },
{ {
{ 256ul, {}, {-1.28f}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, {}, {-1.28f}, {1.27f}, {-128.f}, {127.f} },
{ 256ul, {}, {-1.28f}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, {}, {-1.28f}, {1.27f}, {-128.f}, {127.f} },
ngraph::element::i8,
{ {}, {}, {} },
ngraph::element::i8,
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
}, },
@ -279,8 +297,11 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, {}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f} } { 256ul, {}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }
}, },
{ {
{ 256ul, {}, {0.f}, {2.55f}, {85.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {0.f}, {2.55f}, {85.f}, {255.f} },
{ 256ul, {}, {-1.28f}, {1.27f}, {0.f}, {170.f}, ngraph::element::u8 }, { 256ul, {}, {-1.28f}, {1.27f}, {0.f}, {170.f} },
ngraph::element::u8,
{ {}, {}, {} },
ngraph::element::u8,
{ ngraph::element::f32, { 85 }, { 0.015f } } { ngraph::element::f32, { 85 }, { 0.015f } }
} }
}, },
@ -293,8 +314,11 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, {}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f} } { 256ul, {}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }
}, },
{ {
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, {}, {-1.28f}, {1.27f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {-1.28f}, {1.27f}, {0.f}, {255.f} },
ngraph::element::u8,
{ {}, {}, {} },
ngraph::element::u8,
{ ngraph::element::f32, {{ 0.f, 0.f, 0.f, 128.f, 128.f, 128.f }}, { 0.01f } } { ngraph::element::f32, {{ 0.f, 0.f, 0.f, 128.f, 128.f, 128.f }}, { 0.01f } }
} }
}, },
@ -307,8 +331,11 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {2.55f} } { 256ul, {}, {0.f}, {2.55f}, {0.f}, {2.55f} }
}, },
{ {
{ 256ul, {}, {-1.28f}, {1.27f}, {0.f}, {170.f}, ngraph::element::u8 }, { 256ul, {}, {-1.28f}, {1.27f}, {0.f}, {170.f} },
{ 256ul, {}, {0.f}, {2.55f}, {85.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {0.f}, {2.55f}, {85.f}, {255.f} },
ngraph::element::u8,
{ {}, {}, {} },
ngraph::element::u8,
{ ngraph::element::f32, { 85 }, { 0.015f } } { ngraph::element::f32, { 85 }, { 0.015f } }
} }
}, },
@ -321,11 +348,31 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, {}, {0.f}, {2.55f}, {-3.873046875f}, {3.84375} } { 256ul, {}, {0.f}, {2.55f}, {-3.873046875f}, {3.84375} }
}, },
{ {
{ 256ul, {}, {-1.28f}, {1.27f}, {128.f}, {204.f}, ngraph::element::u8 }, { 256ul, {}, {-1.28f}, {1.27f}, {128.f}, {204.f} },
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
ngraph::element::u8,
{ {}, {}, {} },
ngraph::element::u8,
{ ngraph::element::f32, { 128 }, { 0.0302619f } } { ngraph::element::f32, { 128 }, { 0.0302619f } }
} }
} },
// not update precisions
{
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
false,
{
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {2.55f} }
},
{
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
ngraph::element::f32,
{ {}, {}, {} },
ngraph::element::f32,
{ {}, {}, { 0.01f } },
}
},
}; };
const std::vector<ngraph::Shape> shapes = { const std::vector<ngraph::Shape> shapes = {
@ -338,7 +385,6 @@ INSTANTIATE_TEST_CASE_P(
ConcatTransformation, ConcatTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(precisions),
::testing::ValuesIn(updatePrecisions),
::testing::ValuesIn(shapes), ::testing::ValuesIn(shapes),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),
ConcatTransformation::getTestCaseName); ConcatTransformation::getTestCaseName);

View File

@ -44,21 +44,23 @@ class ConcatTransformationResultValues {
public: public:
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1;
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2;
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations1; ngraph::element::Type precisionBeforeOp;
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations2; ngraph::builder::subgraph::DequantizationOperations dequantizationBefore;
ngraph::element::Type precisionAfterOperation;
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter1;
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter2;
}; };
inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationResultValues& values) { inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationResultValues& values) {
return out << "_" << return out << "_" <<
values.fakeQuantize1 << "_" << values.fakeQuantize1 << "_" <<
values.fakeQuantize2 << "_" << values.fakeQuantize2 << "_" <<
values.dequantizationOperations1 << "_" << values.dequantizationAfter1 << "_" <<
values.dequantizationOperations2; values.dequantizationAfter2;
} }
class ConcatTransformationTestValues { class ConcatTransformationTestValues {
public: public:
ngraph::Shape inputShape;
ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::pass::low_precision::LayerTransformation::Params params;
bool multiChannels; bool multiChannels;
ConcatTransformationActualValues actual; ConcatTransformationActualValues actual;
@ -71,7 +73,7 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationTes
typedef std::tuple < typedef std::tuple <
ngraph::element::Type, ngraph::element::Type,
bool, ngraph::Shape,
ConcatTransformationTestValues ConcatTransformationTestValues
> ConcatTransformationParams; > ConcatTransformationParams;
@ -79,18 +81,12 @@ class ConcatWithDifferentChildsTransformation : public LayerTransformation, publ
public: public:
void SetUp() override { void SetUp() override {
const ngraph::element::Type precision = std::get<0>(GetParam()); const ngraph::element::Type precision = std::get<0>(GetParam());
const bool updatePrecisions = std::get<1>(GetParam()); const ngraph::Shape inputShape = std::get<1>(GetParam());
ConcatTransformationTestValues testValues = std::get<2>(GetParam()); ConcatTransformationTestValues testValues = std::get<2>(GetParam());
testValues.params.updatePrecisions = updatePrecisions;
if (!updatePrecisions) {
testValues.result.fakeQuantize1.outputPrecision = testValues.actual.fakeQuantize1.outputPrecision;
testValues.result.fakeQuantize2.outputPrecision = testValues.actual.fakeQuantize2.outputPrecision;
}
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithDifferentPrecisionOnChilds( actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithDifferentPrecisionOnChilds(
precision, precision,
testValues.inputShape, inputShape,
testValues.actual.fakeQuantize1, testValues.actual.fakeQuantize1,
testValues.actual.fakeQuantize2); testValues.actual.fakeQuantize2);
@ -104,31 +100,28 @@ public:
transform.add<ngraph::pass::low_precision::ClampTransformation, ngraph::opset1::Clamp>(testValues.params); transform.add<ngraph::pass::low_precision::ClampTransformation, ngraph::opset1::Clamp>(testValues.params);
transform.transform(actualFunction); transform.transform(actualFunction);
if (!updatePrecisions) {
// there is no Convert operation after MaxPool in FP32
testValues.result.dequantizationOperations2.convert = {};
}
referenceFunction = ngraph::builder::subgraph::ConcatFunction::getReferenceWithDifferentPrecisionOnChilds( referenceFunction = ngraph::builder::subgraph::ConcatFunction::getReferenceWithDifferentPrecisionOnChilds(
precision, precision,
testValues.inputShape, inputShape,
testValues.multiChannels, testValues.multiChannels,
testValues.result.fakeQuantize1, testValues.result.fakeQuantize1,
testValues.result.fakeQuantize2, testValues.result.fakeQuantize2,
testValues.result.dequantizationOperations1, testValues.result.precisionBeforeOp,
testValues.result.dequantizationOperations2); testValues.result.dequantizationBefore,
testValues.result.precisionAfterOperation,
testValues.result.dequantizationAfter1,
testValues.result.dequantizationAfter2);
} }
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) { static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
const ngraph::element::Type precision = std::get<0>(obj.param); const ngraph::element::Type precision = std::get<0>(obj.param);
const bool updatePrecision = std::get<1>(obj.param); const ngraph::Shape inputShape = std::get<1>(obj.param);
const ConcatTransformationTestValues testValues = std::get<2>(obj.param); const ConcatTransformationTestValues testValues = std::get<2>(obj.param);
std::ostringstream result; std::ostringstream result;
result << result <<
LayerTransformation::getTestCaseNameByParams(precision, testValues.inputShape, testValues.params) << "_" << LayerTransformation::getTestCaseNameByParams(precision, inputShape, testValues.params) << "_" <<
(testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") << (testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") <<
(updatePrecision ? "updatePrecision_" : "notUpdatePrecision_") <<
testValues.actual << "_" << testValues.actual << "_" <<
testValues.result << "_"; testValues.result << "_";
return result.str(); return result.str();
@ -136,8 +129,6 @@ public:
}; };
TEST_P(ConcatWithDifferentChildsTransformation, CompareFunctions) { TEST_P(ConcatWithDifferentChildsTransformation, CompareFunctions) {
const ConcatTransformationTestValues testValues = std::get<2>(GetParam());
actualFunction->validate_nodes_and_infer_types(); actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true, true, true); auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
ASSERT_TRUE(res.first) << res.second; ASSERT_TRUE(res.first) << res.second;
@ -148,12 +139,14 @@ const std::vector<ngraph::element::Type> precisions = {
// ngraph::element::f16 // ngraph::element::f16
}; };
const std::vector<bool> updatePrecisions = { true, false }; const std::vector<ngraph::Shape> shapes = {
{ 1, 3, 10, 10 },
{ 4, 3, 10, 10 }
};
const std::vector<ConcatTransformationTestValues> testValues = { const std::vector<ConcatTransformationTestValues> testValues = {
// U8 // U8
{ {
{ 1, 3, 10, 10 },
LayerTransformation::createParamsU8I8(), LayerTransformation::createParamsU8I8(),
false, false,
{ {
@ -161,15 +154,17 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} } { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.f} },
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.01f } }, { ngraph::element::f32, {}, { 0.01f } },
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
}, },
// I8 // I8
{ {
{ 1, 3, 10, 10 },
LayerTransformation::createParamsI8I8(), LayerTransformation::createParamsI8I8(),
false, false,
{ {
@ -177,15 +172,17 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} } { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f} },
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64.f}, { 64.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64.f}, { 64.f} },
ngraph::element::i8,
{{}, {}, {}},
ngraph::element::i8,
{ ngraph::element::f32, {}, { 0.01f } }, { ngraph::element::f32, {}, { 0.01f } },
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
}, },
// U8: concat multi channels // U8: concat multi channels
{ {
{ 1, 3, 10, 10 },
LayerTransformation::createParamsU8I8(), LayerTransformation::createParamsU8I8(),
true, true,
{ {
@ -193,15 +190,17 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} } { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 255.f} },
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::u8,
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} },
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} },
} }
}, },
// I8: concat multi channels // I8: concat multi channels
{ {
{ 1, 3, 10, 10 },
LayerTransformation::createParamsI8I8(), LayerTransformation::createParamsI8I8(),
true, true,
{ {
@ -209,12 +208,33 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} } { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f} },
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-128.f}, {127.f} },
ngraph::element::i8,
{{}, {}, {}},
ngraph::element::i8,
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} },
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} },
} }
}, },
// not update precisions
{
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
false,
{
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} }
},
{
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.f} },
ngraph::element::f32,
{{}, {}, {}},
ngraph::element::f32,
{ {}, {}, { 0.01f } },
{ {}, {}, { 0.01f } }
}
},
}; };
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
@ -222,7 +242,7 @@ INSTANTIATE_TEST_CASE_P(
ConcatWithDifferentChildsTransformation, ConcatWithDifferentChildsTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(precisions),
::testing::ValuesIn(updatePrecisions), ::testing::ValuesIn(shapes),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),
ConcatWithDifferentChildsTransformation::getTestCaseName); ConcatWithDifferentChildsTransformation::getTestCaseName);
} // namespace } // namespace

View File

@ -42,16 +42,20 @@ class ConcatTransformationResultValues {
public: public:
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1;
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2;
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations1; ngraph::element::Type precisionBeforeOp;
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations2; ngraph::builder::subgraph::DequantizationOperations dequantizationBefore1;
ngraph::builder::subgraph::DequantizationOperations dequantizationBefore2;
ngraph::element::Type precisionAfterOperation;
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter1;
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter2;
}; };
inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationResultValues& values) { inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationResultValues& values) {
return out << "_" << return out << "_" <<
values.fakeQuantize1 << "_" << values.fakeQuantize1 << "_" <<
values.fakeQuantize2 << "_" << values.fakeQuantize2 << "_" <<
values.dequantizationOperations1 << "_" << values.dequantizationAfter1 << "_" <<
values.dequantizationOperations2; values.dequantizationAfter2;
} }
class ConcatTransformationTestValues { class ConcatTransformationTestValues {
@ -69,7 +73,6 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationTes
typedef std::tuple < typedef std::tuple <
ngraph::element::Type, ngraph::element::Type,
bool,
ngraph::Shape, ngraph::Shape,
ConcatTransformationTestValues ConcatTransformationTestValues
> ConcatTransformationParams; > ConcatTransformationParams;
@ -78,15 +81,8 @@ class ConcatWithIntermediateTransformation : public LayerTransformation, public
public: public:
void SetUp() override { void SetUp() override {
const ngraph::element::Type precision = std::get<0>(GetParam()); const ngraph::element::Type precision = std::get<0>(GetParam());
const bool updatePrecisions = std::get<1>(GetParam()); const ngraph::Shape shape = std::get<1>(GetParam());
const ngraph::Shape shape = std::get<2>(GetParam()); ConcatTransformationTestValues testValues = std::get<2>(GetParam());
ConcatTransformationTestValues testValues = std::get<3>(GetParam());
testValues.params.updatePrecisions = updatePrecisions;
if (!updatePrecisions) {
testValues.result.fakeQuantize1.outputPrecision = testValues.actual.fakeQuantize1.outputPrecision;
testValues.result.fakeQuantize2.outputPrecision = testValues.actual.fakeQuantize2.outputPrecision;
}
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithIntermediate( actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithIntermediate(
precision, precision,
@ -110,21 +106,23 @@ public:
testValues.transparentIntermediate, testValues.transparentIntermediate,
testValues.result.fakeQuantize1, testValues.result.fakeQuantize1,
testValues.result.fakeQuantize2, testValues.result.fakeQuantize2,
testValues.result.dequantizationOperations1, testValues.result.precisionBeforeOp,
testValues.result.dequantizationOperations2); testValues.result.dequantizationBefore1,
testValues.result.dequantizationBefore2,
testValues.result.precisionAfterOperation,
testValues.result.dequantizationAfter1,
testValues.result.dequantizationAfter2);
} }
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) { static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
const ngraph::element::Type precision = std::get<0>(obj.param); const ngraph::element::Type precision = std::get<0>(obj.param);
const bool updatePrecision = std::get<1>(obj.param); const ngraph::Shape shape = std::get<1>(obj.param);
const ngraph::Shape shape = std::get<2>(obj.param); const ConcatTransformationTestValues testValues = std::get<2>(obj.param);
const ConcatTransformationTestValues testValues = std::get<3>(obj.param);
std::ostringstream result; std::ostringstream result;
result << result <<
LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_" << LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_" <<
(testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") << (testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") <<
(updatePrecision ? "updatePrecision_" : "notUpdatePrecision_") <<
testValues.actual << "_" << testValues.actual << "_" <<
testValues.result << "_"; testValues.result << "_";
return result.str(); return result.str();
@ -142,8 +140,6 @@ const std::vector<ngraph::element::Type> precisions = {
// ngraph::element::f16 // ngraph::element::f16
}; };
const std::vector<bool> updatePrecisions = { true, false };
const std::vector<ConcatTransformationTestValues> testValues = { const std::vector<ConcatTransformationTestValues> testValues = {
// U8: concat // U8: concat
{ {
@ -155,8 +151,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} } { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.f} },
ngraph::element::u8,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.01f } }, { ngraph::element::f32, {}, { 0.01f } },
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
@ -171,8 +171,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} } { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f} },
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64.f}, { 64.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64.f}, { 64.f} },
ngraph::element::i8,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::i8,
{ ngraph::element::f32, {}, { 0.01f } }, { ngraph::element::f32, {}, { 0.01f } },
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
@ -187,8 +191,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {1.275f}, {2.55f} } { 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {1.275f}, {2.55f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {128.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {128.f}, {255.f} },
ngraph::element::u8,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.01f } }, { ngraph::element::f32, {}, { 0.01f } },
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
@ -203,8 +211,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} } { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 255.f} },
ngraph::element::u8,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::u8,
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} },
{ ngraph::element::f32, {}, { 0.005f } } { ngraph::element::f32, {}, { 0.005f } }
} }
@ -219,8 +231,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} } { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f} },
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-128.f}, {127.f} },
ngraph::element::i8,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::i8,
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} },
{ ngraph::element::f32, {}, { 0.005f } } { ngraph::element::f32, {}, { 0.005f } }
} }
@ -235,8 +251,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {1.275f}, {2.55f} } { 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {1.275f}, {2.55f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {0.f}, {255.f} },
ngraph::element::u8,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::u8,
{ {
ngraph::element::f32, ngraph::element::f32,
{{ 0.f, 0.f, 0.f, -255.f, -255.f, -255.f }}, {{ 0.f, 0.f, 0.f, -255.f, -255.f, -255.f }},
@ -245,6 +265,26 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ ngraph::element::f32, {-255.f}, { 0.005f } } { ngraph::element::f32, {-255.f}, { 0.005f } }
} }
}, },
// not update precisions
{
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
false,
true,
{
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} }
},
{
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.f} },
ngraph::element::f32,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::f32,
{ {}, {}, { 0.01f } },
{ {}, {}, { 0.01f } }
}
},
}; };
const std::vector<ngraph::Shape> shapes = { const std::vector<ngraph::Shape> shapes = {
@ -257,7 +297,6 @@ INSTANTIATE_TEST_CASE_P(
ConcatWithIntermediateTransformation, ConcatWithIntermediateTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(precisions),
::testing::ValuesIn(updatePrecisions),
::testing::ValuesIn(shapes), ::testing::ValuesIn(shapes),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),
ConcatWithIntermediateTransformation::getTestCaseName); ConcatWithIntermediateTransformation::getTestCaseName);

View File

@ -215,7 +215,7 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ {}, {}, {} }, { {}, {}, {} },
ngraph::element::f32, ngraph::element::f32,
ngraph::element::f32, ngraph::element::f32,
{ ngraph::element::f32, {}, { 0.01f } }, { {}, {}, { 0.01f } },
ngraph::element::f32 ngraph::element::f32
} }
}, },
@ -296,7 +296,7 @@ const std::vector<ConcatTransformationTestValues> testValues = {
ngraph::element::f32, ngraph::element::f32,
ngraph::element::f32, ngraph::element::f32,
{ {
ngraph::element::f32, {},
{{ -255.f, -255.f, -255.f, 0.f, 0.f, 0.f }}, {{ -255.f, -255.f, -255.f, 0.f, 0.f, 0.f }},
{{ 0.005f, 0.005f, 0.005f, 0.01f, 0.01f, 0.01f }} {{ 0.005f, 0.005f, 0.005f, 0.01f, 0.01f, 0.01f }}
}, },

View File

@ -43,8 +43,11 @@ public:
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1;
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2;
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize3; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize3;
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations1; ngraph::element::Type precisionBeforeOp;
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations2; ngraph::builder::subgraph::DequantizationOperations dequantizationBefore;
ngraph::element::Type precisionAfterOp;
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter1;
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter2;
}; };
inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationResultValues& values) { inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationResultValues& values) {
@ -52,8 +55,8 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationRes
values.fakeQuantize1 << "_" << values.fakeQuantize1 << "_" <<
values.fakeQuantize2 << "_" << values.fakeQuantize2 << "_" <<
values.fakeQuantize3 << "_" << values.fakeQuantize3 << "_" <<
values.dequantizationOperations1 << "_" << values.dequantizationAfter1 << "_" <<
values.dequantizationOperations2; values.dequantizationAfter2;
} }
class ConcatTransformationTestValues { class ConcatTransformationTestValues {
@ -70,7 +73,6 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationTes
typedef std::tuple < typedef std::tuple <
ngraph::element::Type, ngraph::element::Type,
bool,
ngraph::Shape, ngraph::Shape,
ConcatTransformationTestValues ConcatTransformationTestValues
> ConcatTransformationParams; > ConcatTransformationParams;
@ -79,16 +81,8 @@ class ConcatWithNeighborsTransformation : public LayerTransformation, public tes
public: public:
void SetUp() override { void SetUp() override {
const ngraph::element::Type precision = std::get<0>(GetParam()); const ngraph::element::Type precision = std::get<0>(GetParam());
const bool updatePrecisions = std::get<1>(GetParam()); const ngraph::Shape shape = std::get<1>(GetParam());
const ngraph::Shape shape = std::get<2>(GetParam()); ConcatTransformationTestValues testValues = std::get<2>(GetParam());
ConcatTransformationTestValues testValues = std::get<3>(GetParam());
testValues.params.updatePrecisions = updatePrecisions;
if (!updatePrecisions) {
testValues.result.fakeQuantize1.outputPrecision = testValues.actual.fakeQuantize1.outputPrecision;
testValues.result.fakeQuantize2.outputPrecision = testValues.actual.fakeQuantize2.outputPrecision;
testValues.result.fakeQuantize3.outputPrecision = testValues.actual.fakeQuantize3.outputPrecision;
}
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithNeighbors( actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithNeighbors(
precision, precision,
@ -111,21 +105,22 @@ public:
testValues.result.fakeQuantize1, testValues.result.fakeQuantize1,
testValues.result.fakeQuantize2, testValues.result.fakeQuantize2,
testValues.result.fakeQuantize3, testValues.result.fakeQuantize3,
testValues.result.dequantizationOperations1, testValues.result.precisionBeforeOp,
testValues.result.dequantizationOperations2); testValues.result.dequantizationBefore,
testValues.result.precisionAfterOp,
testValues.result.dequantizationAfter1,
testValues.result.dequantizationAfter2);
} }
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) { static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
const ngraph::element::Type precision = std::get<0>(obj.param); const ngraph::element::Type precision = std::get<0>(obj.param);
const bool updatePrecision = std::get<1>(obj.param); const ngraph::Shape shape = std::get<1>(obj.param);
const ngraph::Shape shape = std::get<2>(obj.param); const ConcatTransformationTestValues testValues = std::get<2>(obj.param);
const ConcatTransformationTestValues testValues = std::get<3>(obj.param);
std::ostringstream result; std::ostringstream result;
result << result <<
LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_" << LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_" <<
(testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") << (testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") <<
(updatePrecision ? "updatePrecision_" : "notUpdatePrecision_") <<
testValues.actual << "_" << testValues.actual << "_" <<
testValues.result << "_"; testValues.result << "_";
return result.str(); return result.str();
@ -143,8 +138,6 @@ const std::vector<ngraph::element::Type> precisions = {
// ngraph::element::f16 // ngraph::element::f16
}; };
const std::vector<bool> updatePrecisions = { true, false };
const std::vector<ConcatTransformationTestValues> testValues = { const std::vector<ConcatTransformationTestValues> testValues = {
// U8: concat // U8: concat
{ {
@ -156,9 +149,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f / 3.f} } { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f / 3.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {128.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {128.f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {85.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {85.f} },
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.01f } }, { ngraph::element::f32, {}, { 0.01f } },
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
@ -173,9 +169,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f / 3.f} } { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f / 3.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::u8,
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} },
{ ngraph::element::f32, {}, {{ 0.005f, 0.005f, 0.005f, 0.00333f, 0.00333f, 0.00333f }} } { ngraph::element::f32, {}, {{ 0.005f, 0.005f, 0.005f, 0.00333f, 0.00333f, 0.00333f }} }
} }
@ -190,9 +189,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {1.275f}, {2.55f} } { 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {1.275f}, {2.55f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {0.f}, {255.f} },
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::u8,
{ ngraph::element::f32, {{ 0.f, 0.f, 0.f, -255.f, -255.f, -255.f }}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {{ 0.f, 0.f, 0.f, -255.f, -255.f, -255.f }}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} },
{ ngraph::element::f32, { -255.f }, { 0.005f } } { ngraph::element::f32, { -255.f }, { 0.005f } }
} }
@ -207,9 +209,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {-1.28f / 3.f}, {1.27f / 3.f}, {-1.28f / 3.f}, {1.27f / 3.f} } { 256ul, ngraph::Shape({}), {-1.28f / 3.f}, {1.27f / 3.f}, {-1.28f / 3.f}, {1.27f / 3.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f} },
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64}, {64.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64}, {64.f} },
{ 256ul, ngraph::Shape({}), {-1.28f / 3.f}, {1.27f / 3.f}, {-43}, {42.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f / 3.f}, {1.27f / 3.f}, {-43}, {42.f} },
ngraph::element::i8,
{{}, {}, {}},
ngraph::element::i8,
{ ngraph::element::f32, {}, { 0.01f } }, { ngraph::element::f32, {}, { 0.01f } },
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
@ -224,9 +229,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {-1.28f / 3.f}, {1.27f / 3.f}, {-1.28f / 3.f}, {1.27f / 3.f} } { 256ul, ngraph::Shape({}), {-1.28f / 3.f}, {1.27f / 3.f}, {-1.28f / 3.f}, {1.27f / 3.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f} },
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-128.f}, {127.f} },
{ 256ul, ngraph::Shape({}), {-1.28f / 3.f}, {1.27f / 3.f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f / 3.f}, {1.27f / 3.f}, {-128.f}, {127.f} },
ngraph::element::i8,
{{}, {}, {}},
ngraph::element::i8,
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} },
{ ngraph::element::f32, {}, {{ 0.005f, 0.005f, 0.005f, 0.00333f, 0.00333f, 0.00333f }} } { ngraph::element::f32, {}, {{ 0.005f, 0.005f, 0.005f, 0.00333f, 0.00333f, 0.00333f }} }
} }
@ -241,13 +249,36 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} } { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {0.f}, {255.f} },
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::u8,
{ ngraph::element::f32, {{ 0.f, 0.f, 0.f, 128.f, 128.f, 128.f }}, { 0.01f } }, { ngraph::element::f32, {{ 0.f, 0.f, 0.f, 128.f, 128.f, 128.f }}, { 0.01f } },
{ ngraph::element::f32, { 128.f }, { 0.01f } } { ngraph::element::f32, { 128.f }, { 0.01f } }
} }
}, },
// not update precisions
{
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
true,
{
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }
},
{
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {0.f}, {255.f} },
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {0.f}, {255.f} },
ngraph::element::f32,
{{}, {}, {}},
ngraph::element::f32,
{ {}, {{ 0.f, 0.f, 0.f, 128.f, 128.f, 128.f }}, { 0.01f } },
{ {}, { 128.f }, { 0.01f } }
}
},
}; };
const std::vector<ngraph::Shape> shapes = { const std::vector<ngraph::Shape> shapes = {
@ -260,7 +291,6 @@ INSTANTIATE_TEST_CASE_P(
ConcatWithNeighborsTransformation, ConcatWithNeighborsTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(precisions),
::testing::ValuesIn(updatePrecisions),
::testing::ValuesIn(shapes), ::testing::ValuesIn(shapes),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),
ConcatWithNeighborsTransformation::getTestCaseName); ConcatWithNeighborsTransformation::getTestCaseName);

View File

@ -45,6 +45,8 @@ public:
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize1; ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize1;
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize2; ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize2;
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize3; ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize3;
ngraph::element::Type precisionBeforeOp;
ngraph::element::Type precisionAfterOp;
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations; ngraph::builder::subgraph::DequantizationOperations dequantizationOperations;
}; };
@ -65,7 +67,6 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationTes
typedef std::tuple < typedef std::tuple <
ngraph::element::Type, ngraph::element::Type,
bool,
ngraph::Shape, ngraph::Shape,
ConcatTransformationTestValues ConcatTransformationTestValues
> ConcatTransformationParams; > ConcatTransformationParams;
@ -74,16 +75,8 @@ class ConcatWithReshapeAtTheEndTransformation : public LayerTransformation, publ
public: public:
void SetUp() override { void SetUp() override {
const ngraph::element::Type precision = std::get<0>(GetParam()); const ngraph::element::Type precision = std::get<0>(GetParam());
const bool updatePrecisions = std::get<1>(GetParam()); const ngraph::Shape shape = std::get<1>(GetParam());
const ngraph::Shape shape = std::get<2>(GetParam()); ConcatTransformationTestValues testValues = std::get<2>(GetParam());
ConcatTransformationTestValues testValues = std::get<3>(GetParam());
testValues.params.updatePrecisions = updatePrecisions;
if (!updatePrecisions) {
testValues.result.fakeQuantize1.outputPrecision = testValues.actual.fakeQuantize1.outputPrecision;
testValues.result.fakeQuantize2.outputPrecision = testValues.actual.fakeQuantize2.outputPrecision;
testValues.result.fakeQuantize3.outputPrecision = testValues.actual.fakeQuantize3.outputPrecision;
}
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithReshapeAtTheEndTransformation( actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithReshapeAtTheEndTransformation(
precision, precision,
@ -98,30 +91,25 @@ public:
transform.add<ngraph::pass::low_precision::ReshapeTransformation, ngraph::opset1::Reshape>(testValues.params); transform.add<ngraph::pass::low_precision::ReshapeTransformation, ngraph::opset1::Reshape>(testValues.params);
transform.transform(actualFunction); transform.transform(actualFunction);
if (!testValues.params.updatePrecisions) {
// there is no Convert operation after MaxPool in FP32
testValues.result.dequantizationOperations.convert = {};
}
referenceFunction = ngraph::builder::subgraph::ConcatFunction::getReferenceWithReshapeAtTheEndTransformation( referenceFunction = ngraph::builder::subgraph::ConcatFunction::getReferenceWithReshapeAtTheEndTransformation(
precision, precision,
shape, shape,
testValues.result.fakeQuantize1, testValues.result.fakeQuantize1,
testValues.result.fakeQuantize2, testValues.result.fakeQuantize2,
testValues.result.fakeQuantize3, testValues.result.fakeQuantize3,
testValues.result.precisionBeforeOp,
testValues.result.precisionAfterOp,
testValues.result.dequantizationOperations); testValues.result.dequantizationOperations);
} }
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) { static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
const ngraph::element::Type precision = std::get<0>(obj.param); const ngraph::element::Type precision = std::get<0>(obj.param);
const bool updatePrecision = std::get<1>(obj.param); const ngraph::Shape shape = std::get<1>(obj.param);
const ngraph::Shape shape = std::get<2>(obj.param); const ConcatTransformationTestValues testValues = std::get<2>(obj.param);
const ConcatTransformationTestValues testValues = std::get<3>(obj.param);
std::ostringstream result; std::ostringstream result;
result << result <<
LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_" << LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_" <<
(updatePrecision ? "updatePrecision_" : "notUpdatePrecision_") <<
testValues.actual << "_" << testValues.actual << "_" <<
testValues.result << "_"; testValues.result << "_";
return result.str(); return result.str();
@ -138,8 +126,6 @@ const std::vector<ngraph::element::Type> precisions = {
ngraph::element::f32, ngraph::element::f32,
}; };
const std::vector<bool> updatePrecisions = { true, false };
const std::vector<ConcatTransformationTestValues> testValues = { const std::vector<ConcatTransformationTestValues> testValues = {
{ {
LayerTransformation::createParamsU8I8(), LayerTransformation::createParamsU8I8(),
@ -149,12 +135,30 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {2.55f} }, { 256ul, {}, {0.f}, {2.55f}, {0.f}, {2.55f} },
}, },
{ {
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
ngraph::element::u8,
ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
}, },
{
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
{
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {2.55f} },
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {2.55f} },
},
{
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
ngraph::element::f32,
ngraph::element::f32,
{ {}, {}, { 0.01f } }
}
},
{ {
LayerTransformation::createParamsU8I8(), LayerTransformation::createParamsU8I8(),
{ {
@ -178,20 +182,20 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ {
256ul, 256ul,
{{1, 3, 1, 1}, {1, 3, 1, 1}, {}, {}}, {{1, 3, 1, 1}, {1, 3, 1, 1}, {}, {}},
{0.f, 0.f, 0.f}, {2.55f / 1.f, 2.55f / 2.f, 2.55f / 3.f}, {0.f}, {255.f}, ngraph::element::u8 {0.f, 0.f, 0.f}, {2.55f / 1.f, 2.55f / 2.f, 2.55f / 3.f}, {0.f}, {255.f}
}, },
{ {
256ul, 256ul,
{{1, 3, 1, 1}, {1, 3, 1, 1}, {}, {}}, {{1, 3, 1, 1}, {1, 3, 1, 1}, {}, {}},
{0.f, 0.f, 0.f}, {2.55f / 1.f, 2.55f / 2.f, 2.55f / 3.f}, {0.f}, {255.f}, {0.f, 0.f, 0.f}, {2.55f / 1.f, 2.55f / 2.f, 2.55f / 3.f}, {0.f}, {255.f}
ngraph::element::u8
}, },
{ {
256ul, 256ul,
{{1, 3, 1, 1}, {1, 3, 1, 1}, {}, {}}, {{1, 3, 1, 1}, {1, 3, 1, 1}, {}, {}},
{0.f, 0.f, 0.f}, {2.55f / 1.f, 2.55f / 2.f, 2.55f / 3.f}, {0.f}, {255.f}, {0.f, 0.f, 0.f}, {2.55f / 1.f, 2.55f / 2.f, 2.55f / 3.f}, {0.f}, {255.f}
ngraph::element::u8
}, },
ngraph::element::u8,
ngraph::element::u8,
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f / 2.f, 0.01f / 3.f, 0.01f, 0.01f / 2.f, 0.01f / 3.f, 0.01f, 0.01f / 2.f, 0.01f / 3.f }} } { ngraph::element::f32, {}, {{ 0.01f, 0.01f / 2.f, 0.01f / 3.f, 0.01f, 0.01f / 2.f, 0.01f / 3.f, 0.01f, 0.01f / 2.f, 0.01f / 3.f }} }
} }
} }
@ -207,7 +211,6 @@ INSTANTIATE_TEST_CASE_P(
ConcatWithReshapeAtTheEndTransformation, ConcatWithReshapeAtTheEndTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(precisions),
::testing::ValuesIn(updatePrecisions),
::testing::ValuesIn(shapes), ::testing::ValuesIn(shapes),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),
ConcatWithReshapeAtTheEndTransformation::getTestCaseName); ConcatWithReshapeAtTheEndTransformation::getTestCaseName);

View File

@ -43,6 +43,10 @@ class ConcatTransformationResultValues {
public: public:
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1;
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2;
ngraph::element::Type precisionBeforeOp;
ngraph::builder::subgraph::DequantizationOperations dequantizationBefore1;
ngraph::builder::subgraph::DequantizationOperations dequantizationBefore2;
ngraph::element::Type precisionAfterOperation;
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations1; ngraph::builder::subgraph::DequantizationOperations dequantizationOperations1;
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations2; ngraph::builder::subgraph::DequantizationOperations dequantizationOperations2;
}; };
@ -70,7 +74,6 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationTes
typedef std::tuple < typedef std::tuple <
ngraph::element::Type, ngraph::element::Type,
bool,
ConcatTransformationTestValues ConcatTransformationTestValues
> ConcatTransformationParams; > ConcatTransformationParams;
@ -78,14 +81,7 @@ class ConcatWithSplitTransformation : public LayerTransformation, public testing
public: public:
void SetUp() override { void SetUp() override {
const ngraph::element::Type precision = std::get<0>(GetParam()); const ngraph::element::Type precision = std::get<0>(GetParam());
const bool updatePrecisions = std::get<1>(GetParam()); ConcatTransformationTestValues testValues = std::get<1>(GetParam());
ConcatTransformationTestValues testValues = std::get<2>(GetParam());
testValues.params.updatePrecisions = updatePrecisions;
if (!updatePrecisions) {
testValues.result.fakeQuantize1.outputPrecision = testValues.actual.fakeQuantize1.outputPrecision;
testValues.result.fakeQuantize2.outputPrecision = testValues.actual.fakeQuantize2.outputPrecision;
}
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithSplitedIntermediate( actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithSplitedIntermediate(
precision, precision,
@ -107,20 +103,22 @@ public:
testValues.inputShape, testValues.inputShape,
testValues.result.fakeQuantize1, testValues.result.fakeQuantize1,
testValues.result.fakeQuantize2, testValues.result.fakeQuantize2,
testValues.result.precisionBeforeOp,
testValues.result.dequantizationBefore1,
testValues.result.dequantizationBefore2,
testValues.result.precisionAfterOperation,
testValues.result.dequantizationOperations1, testValues.result.dequantizationOperations1,
testValues.result.dequantizationOperations2); testValues.result.dequantizationOperations2);
} }
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) { static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
const ngraph::element::Type precision = std::get<0>(obj.param); const ngraph::element::Type precision = std::get<0>(obj.param);
const bool updatePrecision = std::get<1>(obj.param); const ConcatTransformationTestValues testValues = std::get<1>(obj.param);
const ConcatTransformationTestValues testValues = std::get<2>(obj.param);
std::ostringstream result; std::ostringstream result;
result << result <<
LayerTransformation::getTestCaseNameByParams(precision, testValues.inputShape, testValues.params) << "_" << LayerTransformation::getTestCaseNameByParams(precision, testValues.inputShape, testValues.params) << "_" <<
(testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") << (testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") <<
(updatePrecision ? "updatePrecision_" : "notUpdatePrecision_") <<
testValues.actual << "_" << testValues.actual << "_" <<
testValues.result << "_"; testValues.result << "_";
return result.str(); return result.str();
@ -128,8 +126,6 @@ public:
}; };
TEST_P(ConcatWithSplitTransformation, CompareFunctions) { TEST_P(ConcatWithSplitTransformation, CompareFunctions) {
const ConcatTransformationTestValues testValues = std::get<2>(GetParam());
actualFunction->validate_nodes_and_infer_types(); actualFunction->validate_nodes_and_infer_types();
auto res = compare_functions(referenceFunction, actualFunction, true); auto res = compare_functions(referenceFunction, actualFunction, true);
ASSERT_TRUE(res.first) << res.second; ASSERT_TRUE(res.first) << res.second;
@ -140,8 +136,6 @@ const std::vector<ngraph::element::Type> precisions = {
// ngraph::element::f16 // ngraph::element::f16
}; };
const std::vector<bool> updatePrecisions = { true, false };
const std::vector<ConcatTransformationTestValues> testValues = { const std::vector<ConcatTransformationTestValues> testValues = {
// U8: concat // U8: concat
{ {
@ -153,8 +147,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} } { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}},
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.f}},
ngraph::element::u8,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.01f } }, { ngraph::element::f32, {}, { 0.01f } },
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
@ -169,8 +167,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} } { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f}},
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64.f}, { 64.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64.f}, { 64.f}},
ngraph::element::i8,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::i8,
{ ngraph::element::f32, {}, { 0.01f } }, { ngraph::element::f32, {}, { 0.01f } },
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
@ -185,8 +187,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {1.275f}, {2.55f} } { 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {1.275f}, {2.55f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}},
{ 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {128.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {128.f}, {255.f}},
ngraph::element::u8,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.01f } }, { ngraph::element::f32, {}, { 0.01f } },
{ ngraph::element::f32, {}, { 0.01f } } { ngraph::element::f32, {}, { 0.01f } }
} }
@ -201,8 +207,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} } { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, {2.55f / 2.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f}},
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 255.f}, ngraph::element::u8 }, { 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 255.f}},
ngraph::element::u8,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::u8,
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} },
{ ngraph::element::f32, {}, { 0.005f } } { ngraph::element::f32, {}, { 0.005f } }
} }
@ -217,21 +227,44 @@ const std::vector<ConcatTransformationTestValues> testValues = {
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} } { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} }
}, },
{ {
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f}},
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-128.f}, {127.f}, ngraph::element::i8 }, { 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-128.f}, {127.f}},
ngraph::element::i8,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::i8,
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} }, { ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} },
{ ngraph::element::f32, {}, { 0.005f } } { ngraph::element::f32, {}, { 0.005f } }
} }
}, },
// not update precisions
{
{ 1, 6, 10, 10 },
LayerTransformation::createParamsI8I8().setUpdatePrecisions(false),
true,
{
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-1.28f}, {1.27f} },
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-1.28f / 2.f}, {1.27f / 2.f} }
},
{
{ 256ul, ngraph::Shape({}), {-1.28f}, {1.27f}, {-128.f}, {127.f}},
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-128.f}, {127.f}},
ngraph::element::f32,
{{}, {}, {}},
{{}, {}, {}},
ngraph::element::f32,
{ {}, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 0.005f }} },
{ {}, {}, { 0.005f } }
}
},
}; };
// TODO: Split/VariadicSplit operations are not supported in ConcatTransformation // TODO: Split/VariadicSplit operations are not supported in ConcatTransformation
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
DISABLED_LPT, DISABLED_smoke_LPT,
ConcatWithSplitTransformation, ConcatWithSplitTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(precisions),
::testing::ValuesIn(updatePrecisions),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),
ConcatWithSplitTransformation::getTestCaseName); ConcatWithSplitTransformation::getTestCaseName);
} // namespace } // namespace

View File

@ -34,6 +34,7 @@ public:
public: public:
ngraph::element::Type precisionBeforeDequantization; ngraph::element::Type precisionBeforeDequantization;
ngraph::builder::subgraph::DequantizationOperations dequantizationBefore; ngraph::builder::subgraph::DequantizationOperations dequantizationBefore;
ngraph::element::Type precisionAfterOperation;
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter; ngraph::builder::subgraph::DequantizationOperations dequantizationAfter;
}; };
@ -68,6 +69,7 @@ public:
testValues.blockSize, testValues.blockSize,
testValues.expected.precisionBeforeDequantization, testValues.expected.precisionBeforeDequantization,
testValues.expected.dequantizationBefore, testValues.expected.dequantizationBefore,
testValues.expected.precisionAfterOperation,
testValues.expected.dequantizationAfter); testValues.expected.dequantizationAfter);
} }
@ -110,6 +112,7 @@ const std::vector<DepthToSpaceTransformationTestValues> testValues = {
{ {
ngraph::element::u8, ngraph::element::u8,
{{}, {}, {}}, {{}, {}, {}},
ngraph::element::u8,
{{ngraph::element::f32}, {0.32f}, {0.45f}} {{ngraph::element::f32}, {0.32f}, {0.45f}}
} }
}, },
@ -126,6 +129,7 @@ const std::vector<DepthToSpaceTransformationTestValues> testValues = {
{ {
ngraph::element::u8, ngraph::element::u8,
{{}, {}, {}}, {{}, {}, {}},
ngraph::element::u8,
{{ngraph::element::f32}, {0.32f}, {0.45f}} {{ngraph::element::f32}, {0.32f}, {0.45f}}
} }
}, },
@ -142,10 +146,11 @@ const std::vector<DepthToSpaceTransformationTestValues> testValues = {
{ {
ngraph::element::u8, ngraph::element::u8,
{{}, {}, {}}, {{}, {}, {}},
ngraph::element::u8,
{{ngraph::element::f32}, {0.32f}, {0.45f}} {{ngraph::element::f32}, {0.32f}, {0.45f}}
} }
}, },
// not scalar-like dequantizations // not scalar-like dequantizations with different values
{ {
ngraph::Shape{ 1, 4, 3, 3 }, ngraph::Shape{ 1, 4, 3, 3 },
DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST, DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST,
@ -166,9 +171,56 @@ const std::vector<DepthToSpaceTransformationTestValues> testValues = {
{{0.32f, 0.5f, 0.6f, 0.77f}}, {{0.32f, 0.5f, 0.6f, 0.77f}},
{{0.1f, 0.55f, 0.3f, 0.8f}} {{0.1f, 0.55f, 0.3f, 0.8f}}
}, },
ngraph::element::f32,
{ {}, {}, {}}
}
},
// not scalar-like dequantizations with the same values
{
ngraph::Shape{ 1, 4, 3, 3 },
DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST,
2,
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{
{ngraph::element::f32},
{{0.32f, 0.32f, 0.32f, 0.32f}},
{{0.1f, 0.1f, 0.1f, 0.1f}}
}
},
{
ngraph::element::u8,
{ {}, {}, {}},
ngraph::element::u8,
{
{ngraph::element::f32},
{{0.32f, 0.32f, 0.32f, 0.32f}},
{{0.1f, 0.1f, 0.1f, 0.1f}}
}
}
},
// without dequantization
{
ngraph::Shape{ 1, 4, 3, 3 },
DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST,
2,
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{}
},
{
ngraph::element::u8,
{ {}, {}, {}},
ngraph::element::u8,
{ {}, {}, {}} { {}, {}, {}}
} }
}, },
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, DepthToSpaceTransformation, ::testing::ValuesIn(testValues), DepthToSpaceTransformation::getTestCaseName); INSTANTIATE_TEST_CASE_P(
smoke_LPT,
DepthToSpaceTransformation,
::testing::ValuesIn(testValues),
DepthToSpaceTransformation::getTestCaseName);

View File

@ -18,6 +18,7 @@
#include "lpt_ngraph_functions/common/fake_quantize_on_data.hpp" #include "lpt_ngraph_functions/common/fake_quantize_on_data.hpp"
#include "lpt_ngraph_functions/common/fake_quantize_on_weights.hpp" #include "lpt_ngraph_functions/common/fake_quantize_on_weights.hpp"
#include "lpt_ngraph_functions/common/dequantization_operations.hpp"
#include "lpt_ngraph_functions/fake_quantize_and_two_output_branches_with_convolution_function.hpp" #include "lpt_ngraph_functions/fake_quantize_and_two_output_branches_with_convolution_function.hpp"
#include "simple_low_precision_transformer.hpp" #include "simple_low_precision_transformer.hpp"
@ -28,35 +29,33 @@ using namespace ngraph::pass;
class FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues { class FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues {
public: public:
class ActualValues {
public:
ngraph::builder::subgraph::FakeQuantizeOnData fqOnData;
ngraph::builder::subgraph::FakeQuantizeOnWeights fqOnWeights1;
ngraph::builder::subgraph::FakeQuantizeOnWeights fqOnWeights2;
};
class ExpectedValues {
public:
ngraph::builder::subgraph::FakeQuantizeOnData fqOnData;
ngraph::element::Type precisionBeforeOp;
ngraph::builder::subgraph::DequantizationOperations dequantizationBefore;
ngraph::element::Type precisionAfterOp;
ngraph::builder::subgraph::FakeQuantizeOnWeights fqOnWeights1;
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter1;
ngraph::builder::subgraph::FakeQuantizeOnWeights fqOnWeights2;
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter2;
};
low_precision::LayerTransformation::Params params; low_precision::LayerTransformation::Params params;
ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::ActualValues actual; ActualValues actual;
ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::ExpectedValues expected; ExpectedValues expected;
}; };
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 FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues& testValue) {
return out << "_" <<
testValue.params.precisionsOnActivations[0] << "_" <<
testValue.actual.fqOnData << "_" <<
testValue.actual.fqOnWeights1 << "_" <<
testValue.actual.fqOnWeights2;
}
typedef std::tuple< typedef std::tuple<
ngraph::element::Type, ngraph::element::Type,
ngraph::Shape, ngraph::Shape,
bool,
FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues> FakeQuantizeAndTwoOutputBranchesWithConvolutionParams; FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues> FakeQuantizeAndTwoOutputBranchesWithConvolutionParams;
class FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation : class FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation :
@ -66,39 +65,41 @@ public:
void SetUp() override { void SetUp() override {
const ngraph::element::Type precision = std::get<0>(GetParam()); const ngraph::element::Type precision = std::get<0>(GetParam());
const ngraph::Shape shape = std::get<1>(GetParam()); const ngraph::Shape shape = std::get<1>(GetParam());
const bool updatePrecision = std::get<2>(GetParam()); const FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues testValues = std::get<2>(GetParam());
const FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues testValues = std::get<3>(GetParam());
const low_precision::LayerTransformation::Params params = low_precision::LayerTransformation::Params(testValues.params).
setUpdatePrecisions(updatePrecision);
actualFunction = ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::getOriginal( actualFunction = ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::getOriginal(
precision, precision,
shape, shape,
testValues.actual); testValues.actual.fqOnData,
testValues.actual.fqOnWeights1,
testValues.actual.fqOnWeights2);
SimpleLowPrecisionTransformer transform; SimpleLowPrecisionTransformer transform;
transform.add<ngraph::pass::low_precision::FakeQuantizeTransformation, ngraph::opset1::FakeQuantize>(params); transform.add<ngraph::pass::low_precision::FakeQuantizeTransformation, ngraph::opset1::FakeQuantize>(testValues.params);
transform.add<ngraph::pass::low_precision::ConvolutionTransformation, ngraph::opset1::Convolution>(params); transform.add<ngraph::pass::low_precision::ConvolutionTransformation, ngraph::opset1::Convolution>(testValues.params);
transform.transform(actualFunction); transform.transform(actualFunction);
referenceFunction = ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::getReference( referenceFunction = ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::getReference(
precision, precision,
shape, shape,
params, testValues.params,
testValues.expected); testValues.expected.fqOnData,
testValues.expected.precisionBeforeOp,
testValues.expected.dequantizationBefore,
testValues.expected.precisionAfterOp,
testValues.expected.dequantizationAfter1,
testValues.expected.dequantizationAfter2);
} }
static std::string getTestCaseName(testing::TestParamInfo<FakeQuantizeAndTwoOutputBranchesWithConvolutionParams> obj) { static std::string getTestCaseName(testing::TestParamInfo<FakeQuantizeAndTwoOutputBranchesWithConvolutionParams> obj) {
const ngraph::element::Type precision = std::get<0>(obj.param); const ngraph::element::Type precision = std::get<0>(obj.param);
const ngraph::Shape shape = std::get<1>(obj.param); const ngraph::Shape shape = std::get<1>(obj.param);
const bool updatePrecision = std::get<2>(obj.param); const FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues testValues = std::get<2>(obj.param);
const FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues testValues = std::get<3>(obj.param);
std::ostringstream result; std::ostringstream result;
result << LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << result << LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_"
(updatePrecision ? "" : "_notUpdatePrecision_") << << testValues.expected.fqOnData << "_" << testValues.expected.dequantizationAfter1 << "_"
testValues; << testValues.expected.dequantizationAfter2;
return result.str(); return result.str();
} }
}; };
@ -114,11 +115,6 @@ const std::vector<ngraph::element::Type> precisions = {
// ngraph::element::f16 // ngraph::element::f16
}; };
const std::vector<bool> updatePrecisions = {
true,
false
};
const std::vector<FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues> fakeQuantizeOnDataTestValues = { const std::vector<FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues> fakeQuantizeOnDataTestValues = {
// U8 // U8
{ {
@ -130,10 +126,32 @@ const std::vector<FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues> fak
}, },
{ {
{ 256ul, {}, { 0.f }, { 2.55f }, { 0.f }, { 2.55f } }, { 256ul, {}, { 0.f }, { 2.55f }, { 0.f }, { 2.55f } },
ngraph::element::u8,
{{}, {}, {}},
ngraph::element::f32,
{ 255ul, {1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f } }, { 255ul, {1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f } },
{ 1.f }, {{}, {}, {{ 1.f }, ngraph::element::f32, { 1, 1, 1 }}},
{ 255ul, {1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f } }, { 255ul, {1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f } },
{ 1.f } {{}, {}, {{ 1.f }, ngraph::element::f32, { 1, 1, 1 }}},
}
},
// not update precisions
{
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
{
{ 256ul, {}, { 0.f }, { 2.55f }, { 0.f }, { 2.55f } },
{ 255ul, {1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f } },
{ 255ul, {1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f } },
},
{
{ 256ul, {}, { 0.f }, { 2.55f }, { 0.f }, { 2.55f } },
ngraph::element::f32,
{{}, {}, {}},
ngraph::element::f32,
{ 255ul, {1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f } },
{{}, {}, {{ 1.f }, ngraph::element::f32, { 1, 1, 1 }}},
{ 255ul, {1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f } },
{{}, {}, {{ 1.f }, ngraph::element::f32, { 1, 1, 1 }}},
} }
} }
}; };
@ -149,6 +167,5 @@ INSTANTIATE_TEST_CASE_P(
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(precisions),
::testing::ValuesIn(shapes), ::testing::ValuesIn(shapes),
::testing::ValuesIn(updatePrecisions),
::testing::ValuesIn(fakeQuantizeOnDataTestValues)), ::testing::ValuesIn(fakeQuantizeOnDataTestValues)),
FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation::getTestCaseName); FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation::getTestCaseName);

View File

@ -15,26 +15,23 @@
#include <low_precision/fake_quantize.hpp> #include <low_precision/fake_quantize.hpp>
#include "common_test_utils/ngraph_test_utils.hpp" #include "common_test_utils/ngraph_test_utils.hpp"
#include "lpt_ngraph_functions/fake_quantize_function.hpp" #include "lpt_ngraph_functions/fake_quantize_function.hpp"
#include "lpt_ngraph_functions/common/dequantization_operations.hpp"
#include "simple_low_precision_transformer.hpp" #include "simple_low_precision_transformer.hpp"
using namespace testing; using namespace testing;
using namespace ngraph; using namespace ngraph;
using namespace ngraph::pass; using namespace ngraph::pass;
class ExpectedValues {
public:
std::vector<float> subtract;
std::vector<float> multiply;
};
class FakeQuantizeTransformationTestValues { class FakeQuantizeTransformationTestValues {
public: public:
low_precision::LayerTransformation::Params params; low_precision::LayerTransformation::Params params;
builder::subgraph::FakeQuantizeOnData actual; builder::subgraph::FakeQuantizeOnData actual;
builder::subgraph::FakeQuantizeOnData expected; builder::subgraph::FakeQuantizeOnData expected;
ngraph::element::Type expectedFakeQuantizeOnDataPrecision; ngraph::element::Type expectedFakeQuantizeOnDataPrecision;
std::map<ngraph::element::Type, ExpectedValues> expectedValues; std::map<ngraph::element::Type, ngraph::builder::subgraph::DequantizationOperations> expectedValues;
}; };
inline std::ostream& operator<<(std::ostream& os, const std::vector<float>& values) { inline std::ostream& operator<<(std::ostream& os, const std::vector<float>& values) {
@ -87,8 +84,7 @@ public:
params.updatePrecisions, params.updatePrecisions,
fakeQuantizeOnData.expected, fakeQuantizeOnData.expected,
fakeQuantizeOnData.expectedFakeQuantizeOnDataPrecision, fakeQuantizeOnData.expectedFakeQuantizeOnDataPrecision,
fakeQuantizeOnData.expectedValues.find(element::f32)->second.subtract, fakeQuantizeOnData.expectedValues.find(element::f32)->second);
fakeQuantizeOnData.expectedValues.find(element::f32)->second.multiply);
} }
static std::string getTestCaseName(testing::TestParamInfo<FakeQuantizeTransformationParams> obj) { static std::string getTestCaseName(testing::TestParamInfo<FakeQuantizeTransformationParams> obj) {
@ -128,8 +124,8 @@ const std::vector<FakeQuantizeTransformationTestValues> fakeQuantizeTransformati
{ 256ul, {}, { 0.f }, { 2.55f }, { 0.f }, { 255.f } }, { 256ul, {}, { 0.f }, { 2.55f }, { 0.f }, { 255.f } },
ngraph::element::u8, ngraph::element::u8,
{ {
{ ngraph::element::f32, { {}, { 0.01f }} }, { ngraph::element::f32, { {ngraph::element::f32}, {}, { 0.01f }} },
{ ngraph::element::f16, { {}, { 0.01f }} } { ngraph::element::f16, { {ngraph::element::f16}, {}, { 0.01f }} }
} }
}, },
{ {
@ -138,8 +134,8 @@ const std::vector<FakeQuantizeTransformationTestValues> fakeQuantizeTransformati
{ 256ul, {}, { -1.23f }, { 2.55f }, { 0.f }, { 255.f } }, { 256ul, {}, { -1.23f }, { 2.55f }, { 0.f }, { 255.f } },
ngraph::element::u8, ngraph::element::u8,
{ {
{ ngraph::element::f32, {{ 82.97619048f }, { 0.014823529f }} }, { ngraph::element::f32, {{ngraph::element::f32}, { 82.97619048f }, { 0.014823529f }} },
{ ngraph::element::f16, {{ 83.f }, { 0.014823529f }} } { ngraph::element::f16, {{ngraph::element::f16}, { 83.f }, { 0.014823529f }} }
} }
}, },
{ {
@ -148,8 +144,8 @@ const std::vector<FakeQuantizeTransformationTestValues> fakeQuantizeTransformati
{ 256ul, {}, { -1.28f} , { 1.27f }, { 0.f }, { 255.f } }, { 256ul, {}, { -1.28f} , { 1.27f }, { 0.f }, { 255.f } },
ngraph::element::u8, ngraph::element::u8,
{ {
{ ngraph::element::f32, {{ 128.f }, { 0.01f }} }, { ngraph::element::f32, {{ngraph::element::f32}, { 128.f }, { 0.01f }} },
{ ngraph::element::f16, {{ 128.f }, { 0.01f }} } { ngraph::element::f16, {{ngraph::element::f16}, { 128.f }, { 0.01f }} }
} }
}, },
@ -160,8 +156,8 @@ const std::vector<FakeQuantizeTransformationTestValues> fakeQuantizeTransformati
{ 256ul, {}, { -1.28f}, { 1.27f }, { -128.f}, { 127.f } }, { 256ul, {}, { -1.28f}, { 1.27f }, { -128.f}, { 127.f } },
ngraph::element::i8, ngraph::element::i8,
{ {
{ ngraph::element::f32, {{ }, { 0.01f }} }, { ngraph::element::f32, {{ngraph::element::f32}, { }, { 0.01f }} },
{ ngraph::element::f16, {{ }, { 0.01f }} } { ngraph::element::f16, {{ngraph::element::f16}, { }, { 0.01f }} }
} }
}, },
{ {
@ -170,8 +166,8 @@ const std::vector<FakeQuantizeTransformationTestValues> fakeQuantizeTransformati
{ 256ul, {}, { -0.12f}, { 1.27f }, { -128.f}, { 127.f } }, { 256ul, {}, { -0.12f}, { 1.27f }, { -128.f}, { 127.f } },
ngraph::element::i8, ngraph::element::i8,
{ {
{ ngraph::element::f32, {{ -105.9856115f }, { 0.00545098f }} }, { ngraph::element::f32, {{ngraph::element::f32}, { -105.9856115f }, { 0.00545098f }} },
{ ngraph::element::f16, {{ -105.9856115f }, { 0.00545098f }} } { ngraph::element::f16, {{ngraph::element::f16}, { -105.9856115f }, { 0.00545098f }} }
} }
}, },
{ {
@ -180,8 +176,8 @@ const std::vector<FakeQuantizeTransformationTestValues> fakeQuantizeTransformati
{ 256ul, {}, { 0.f }, { 2.55f }, { -128.f }, { 127.f } }, { 256ul, {}, { 0.f }, { 2.55f }, { -128.f }, { 127.f } },
ngraph::element::i8, ngraph::element::i8,
{ {
{ ngraph::element::f32, {{ -128.f }, { 0.01f }} }, { ngraph::element::f32, {{ngraph::element::f32}, { -128.f }, { 0.01f }} },
{ ngraph::element::f16, {{ -128.f }, { 0.01f }} } { ngraph::element::f16, {{ngraph::element::f16}, { -128.f }, { 0.01f }} }
} }
}, },
@ -192,7 +188,7 @@ const std::vector<FakeQuantizeTransformationTestValues> fakeQuantizeTransformati
{ 256ul, {}, { 0.f }, { 2.55f }, { 1.f }, { 1.f } }, { 256ul, {}, { 0.f }, { 2.55f }, { 1.f }, { 1.f } },
ngraph::element::Type_t::i8, ngraph::element::Type_t::i8,
{ {
{ ngraph::element::f32, {{}, { 2.55f }} } { ngraph::element::f32, {{ngraph::element::f32}, {}, { 2.55f }} }
} }
}, },
@ -204,8 +200,8 @@ const std::vector<FakeQuantizeTransformationTestValues> fakeQuantizeTransformati
{ 256ul, {}, { -0.504395f }, { 0.5f }, { -128.f }, { 127.f } }, { 256ul, {}, { -0.504395f }, { 0.5f }, { -128.f }, { 127.f } },
ngraph::element::i8, ngraph::element::i8,
{ {
{ ngraph::element::f32, {{ }, { -0.504395f / -128.0f }} }, { ngraph::element::f32, {{ngraph::element::f32}, { }, { -0.504395f / -128.0f }} },
{ ngraph::element::f16, {{ }, { -0.504395f / -128.0f }} } { ngraph::element::f16, {{ngraph::element::f16}, { }, { -0.504395f / -128.0f }} }
} }
}, },
@ -216,8 +212,8 @@ const std::vector<FakeQuantizeTransformationTestValues> fakeQuantizeTransformati
{ 256ul, {}, { 0.f }, { 25.5f }, { 0.f }, { 255.f } }, { 256ul, {}, { 0.f }, { 25.5f }, { 0.f }, { 255.f } },
ngraph::element::u8, ngraph::element::u8,
{ {
{ ngraph::element::f32, {{ }, { 1e-32f }} }, { ngraph::element::f32, {{ngraph::element::f32}, { }, { 1e-32f }} },
{ ngraph::element::f16, {{ }, { 1e-32f }} } { ngraph::element::f16, {{ngraph::element::f16}, { }, { 1e-32f }} }
} }
} }
}; };

View File

@ -5,48 +5,65 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "low_precision/transformer.hpp" #include "low_precision/transformer.hpp"
#include "low_precision/concat_multi_channels.hpp"
#include "low_precision/convolution.hpp"
#include "low_precision/mat_mul.hpp"
#include "low_precision/fuse_convert.hpp"
#include "low_precision/subtract_multiply_to_multiply_add.hpp"
using namespace ::testing; using namespace ::testing;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
class LowPrecisionTransformationsTests : public Test {}; class LowPrecisionTransformationsTests : public Test {};
TEST_F(LowPrecisionTransformationsTests, remove) { TEST_F(LowPrecisionTransformationsTests, removeAll) {
LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params()); LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params());
auto transformation = transformations.find("Convolution"); auto transformation = transformations.find("Convolution");
ASSERT_NE(0, transformation.size()); ASSERT_NE(0, transformation.size());
transformations.remove("Convolution"); transformations.removeAll<ngraph::pass::low_precision::ConvolutionTransformation, ngraph::opset1::Convolution>();
transformation = transformations.find("Convolution"); transformation = transformations.find("Convolution");
ASSERT_EQ(0, transformation.size()); ASSERT_EQ(0, transformation.size());
} }
TEST_F(LowPrecisionTransformationsTests, removeBranchSpecificTransformations) { TEST_F(LowPrecisionTransformationsTests, removeBranchSpecific) {
LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params()); LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params());
auto transformation = transformations.find("Concat"); auto transformation = transformations.find("Concat");
ASSERT_NE(0, transformation.size()); ASSERT_NE(0, transformation.size());
transformations.removeBranchSpecificTransformations("Concat"); transformations.removeBranchSpecific<ngraph::pass::low_precision::ConcatMultiChannelsTransformation, ngraph::opset1::Concat>();
transformation = transformations.find("Concat"); transformation = transformations.find("Concat");
ASSERT_EQ(0, transformation.size()); ASSERT_EQ(0, transformation.size());
} }
TEST_F(LowPrecisionTransformationsTests, removeTransformations) { TEST_F(LowPrecisionTransformationsTests, remove) {
LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params()); LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params());
auto transformation = transformations.find("MatMul"); auto transformation = transformations.find("MatMul");
ASSERT_NE(0, transformation.size()); ASSERT_NE(0, transformation.size());
transformations.removeTransformations("MatMul"); transformations.remove<ngraph::pass::low_precision::MatMulTransformation, ngraph::opset1::MatMul>();
transformation = transformations.find("MatMul"); transformation = transformations.find("MatMul");
ASSERT_EQ(0, transformation.size()); ASSERT_EQ(0, transformation.size());
} }
TEST_F(LowPrecisionTransformationsTests, removeCleanupTransformations) { TEST_F(LowPrecisionTransformationsTests, removeCleanup) {
LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params()); LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params());
auto transformation = transformations.find("Multiply"); auto transformation = transformations.find("Multiply");
ASSERT_NE(0, transformation.size()); ASSERT_NE(0, transformation.size());
const size_t originalSize = transformation.size(); const size_t originalSize = transformation.size();
transformations.removeCleanupTransformations("Multiply"); transformations.removeCleanup<ngraph::pass::low_precision::FuseConvertTransformation, ngraph::opset1::Multiply>();
transformation = transformations.find("Multiply");
ASSERT_EQ(originalSize - 1, transformation.size());
}
TEST_F(LowPrecisionTransformationsTests, removeStandaloneCleanup) {
LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params());
auto transformation = transformations.find("Multiply");
ASSERT_NE(0, transformation.size());
const size_t originalSize = transformation.size();
transformations.removeStandaloneCleanup<ngraph::pass::low_precision::SubtractMultiplyToMultiplyAddTransformation, ngraph::opset1::Multiply>();
transformation = transformations.find("Multiply"); transformation = transformations.find("Multiply");
ASSERT_EQ(originalSize - 1, transformation.size()); ASSERT_EQ(originalSize - 1, transformation.size());
} }

View File

@ -29,6 +29,7 @@ public:
public: public:
ngraph::element::Type precisionBeforeDequantization; ngraph::element::Type precisionBeforeDequantization;
ngraph::builder::subgraph::DequantizationOperations dequantization1; ngraph::builder::subgraph::DequantizationOperations dequantization1;
ngraph::element::Type preicsionAfterOperation;
ngraph::builder::subgraph::DequantizationOperations dequantization2; ngraph::builder::subgraph::DequantizationOperations dequantization2;
}; };
@ -36,6 +37,7 @@ public:
public: public:
ngraph::element::Type precisionBeforeDequantization; ngraph::element::Type precisionBeforeDequantization;
ngraph::builder::subgraph::DequantizationOperations dequantization1; ngraph::builder::subgraph::DequantizationOperations dequantization1;
ngraph::element::Type preicsionAfterOperation;
ngraph::builder::subgraph::DequantizationOperations dequantization2; ngraph::builder::subgraph::DequantizationOperations dequantization2;
}; };
@ -58,6 +60,7 @@ public:
shape, shape,
testValues.actual.precisionBeforeDequantization, testValues.actual.precisionBeforeDequantization,
testValues.actual.dequantization1, testValues.actual.dequantization1,
testValues.actual.preicsionAfterOperation,
testValues.actual.dequantization2); testValues.actual.dequantization2);
SimpleLowPrecisionTransformer transform; SimpleLowPrecisionTransformer transform;
@ -68,6 +71,7 @@ public:
shape, shape,
testValues.expected.precisionBeforeDequantization, testValues.expected.precisionBeforeDequantization,
testValues.expected.dequantization1, testValues.expected.dequantization1,
testValues.expected.preicsionAfterOperation,
testValues.expected.dequantization2); testValues.expected.dequantization2);
} }
@ -104,11 +108,13 @@ const std::vector<MaxPoolTransformationTestValues> testValues = {
{ {
ngraph::element::u8, ngraph::element::u8,
{ {}, {}, { {0.02f}, ngraph::element::f32, {}, true, 1, ngraph::element::f32 }}, { {}, {}, { {0.02f}, ngraph::element::f32, {}, true, 1, ngraph::element::f32 }},
ngraph::element::f32,
{} {}
}, },
{ {
ngraph::element::u8, ngraph::element::u8,
{}, {},
ngraph::element::u8,
{ ngraph::element::f32, {}, { {0.02f}, ngraph::element::f32, {}, true, 1, ngraph::element::f32 }} { ngraph::element::f32, {}, { {0.02f}, ngraph::element::f32, {}, true, 1, ngraph::element::f32 }}
} }
}, },
@ -122,11 +128,13 @@ const std::vector<MaxPoolTransformationTestValues> testValues = {
{ {128.f}, ngraph::element::f32, {}, true, 1, ngraph::element::f32 }, { {128.f}, ngraph::element::f32, {}, true, 1, ngraph::element::f32 },
{ {0.02f}, ngraph::element::f32, {}, true, 1, ngraph::element::f32 } { {0.02f}, ngraph::element::f32, {}, true, 1, ngraph::element::f32 }
}, },
ngraph::element::f32,
{} {}
}, },
{ {
ngraph::element::u8, ngraph::element::u8,
{}, {},
ngraph::element::u8,
{ {
ngraph::element::f32, ngraph::element::f32,
{ {128.f}, ngraph::element::f32, {}, true, 1, ngraph::element::f32 }, { {128.f}, ngraph::element::f32, {}, true, 1, ngraph::element::f32 },
@ -140,11 +148,13 @@ const std::vector<MaxPoolTransformationTestValues> testValues = {
{ {
ngraph::element::u8, ngraph::element::u8,
{ ngraph::element::f32, { 128 }, { 0.02f }}, { ngraph::element::f32, { 128 }, { 0.02f }},
ngraph::element::f32,
{} {}
}, },
{ {
ngraph::element::u8, ngraph::element::u8,
{}, {},
ngraph::element::u8,
{ ngraph::element::f32, { 128 }, { 0.02f }} { ngraph::element::f32, { 128 }, { 0.02f }}
} }
}, },
@ -154,11 +164,13 @@ const std::vector<MaxPoolTransformationTestValues> testValues = {
{ {
ngraph::element::u8, ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.02f }}, { ngraph::element::f32, {}, { 0.02f }},
ngraph::element::f32,
{} {}
}, },
{ {
ngraph::element::u8, ngraph::element::u8,
{}, {},
ngraph::element::u8,
{ ngraph::element::f32, {}, { 0.02f }} { ngraph::element::f32, {}, { 0.02f }}
} }
}, },
@ -166,28 +178,32 @@ const std::vector<MaxPoolTransformationTestValues> testValues = {
{ {
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false), LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
{ {
ngraph::element::u8, ngraph::element::f32,
{ ngraph::element::f32, { 128 }, { 0.02f }}, { ngraph::element::f32, { 128 }, { 0.02f }},
ngraph::element::f32,
{} {}
}, },
{ {
ngraph::element::u8, ngraph::element::f32,
{}, {},
{ ngraph::element::f32, { 128 }, { 0.02f }} ngraph::element::f32,
{ {}, { 128 }, { 0.02f }}
} }
}, },
// Convert + Subtract + Multiply // Convert + Subtract + Multiply
{ {
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false), LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
{ {
ngraph::element::u8, ngraph::element::f32,
{ ngraph::element::f32, {}, { 0.02f }}, { ngraph::element::f32, {}, { 0.02f }},
ngraph::element::f32,
{} {}
}, },
{ {
ngraph::element::u8, ngraph::element::f32,
{}, {},
{ ngraph::element::f32, {}, { 0.02f }} ngraph::element::f32,
{ {}, {}, { 0.02f }}
} }
} }
}; };

View File

@ -15,7 +15,9 @@
#include <low_precision/normalize_l2.hpp> #include <low_precision/normalize_l2.hpp>
#include "common_test_utils/ngraph_test_utils.hpp" #include "common_test_utils/ngraph_test_utils.hpp"
#include "lpt_ngraph_functions/normalize_l2_function.hpp" #include "lpt_ngraph_functions/normalize_l2_function.hpp"
#include "lpt_ngraph_functions/common/dequantization_operations.hpp"
using namespace testing; using namespace testing;
using namespace ngraph::pass; using namespace ngraph::pass;
@ -23,60 +25,72 @@ using namespace ngraph::builder::subgraph;
class NormalizeL2TransformationTestValues { class NormalizeL2TransformationTestValues {
public: public:
class Actual {
public:
ngraph::element::Type inputPrecision;
DequantizationOperations dequantization;
};
class Expected {
public:
ngraph::element::Type inputPrecision;
DequantizationOperations dequantizationBefore;
ngraph::element::Type precisionAfterOperation;
DequantizationOperations dequantizationAfter;
};
low_precision::LayerTransformation::Params transformationParams; low_precision::LayerTransformation::Params transformationParams;
Actual actual;
NormalizeL2ActualValues actual; Expected expected;
NormalizeL2ExpectedValues expected;
}; };
typedef std::tuple< typedef std::tuple<
ngraph::element::Type,
ngraph::Shape, ngraph::Shape,
ngraph::op::EpsMode, ngraph::op::EpsMode,
std::vector<size_t>,
NormalizeL2TransformationTestValues> NormalizeL2TransformationParams; NormalizeL2TransformationTestValues> NormalizeL2TransformationParams;
class NormalizeL2Transformation : public LayerTransformation, public testing::WithParamInterface<NormalizeL2TransformationParams> { class NormalizeL2Transformation : public LayerTransformation, public testing::WithParamInterface<NormalizeL2TransformationParams> {
public: public:
void SetUp() override { void SetUp() override {
const ngraph::element::Type precision = std::get<0>(GetParam()); ngraph::Shape shape;
const ngraph::Shape shape = std::get<1>(GetParam()); ngraph::op::EpsMode epsMode;
const ngraph::op::EpsMode epsMode = std::get<2>(GetParam()); std::vector<size_t> axes;
const NormalizeL2TransformationTestValues params = std::get<3>(GetParam()); NormalizeL2TransformationTestValues params;
std::tie(shape, epsMode, axes, params) = GetParam();
actualFunction = ngraph::builder::subgraph::NormalizeL2Function::getOriginal( actualFunction = ngraph::builder::subgraph::NormalizeL2Function::getOriginal(
precision, params.actual.inputPrecision,
shape, shape,
epsMode, epsMode,
params.actual); axes,
params.actual.dequantization);
SimpleLowPrecisionTransformer transform; SimpleLowPrecisionTransformer transform;
transform.add<low_precision::NormalizeL2Transformation, ngraph::opset1::NormalizeL2>( transform.add<low_precision::NormalizeL2Transformation, ngraph::opset1::NormalizeL2>(
low_precision::LayerTransformation::Params(params.transformationParams)); low_precision::LayerTransformation::Params(params.transformationParams));
transform.transform(actualFunction); transform.transform(actualFunction);
referenceFunction = !params.expected.subtractValues.empty() ? referenceFunction = ngraph::builder::subgraph::NormalizeL2Function::getReference(
ngraph::builder::subgraph::NormalizeL2Function::getOriginal( params.expected.inputPrecision,
precision, shape,
shape, epsMode,
epsMode, axes,
params.actual) : params.expected.dequantizationBefore,
ngraph::builder::subgraph::NormalizeL2Function::getReference( params.expected.precisionAfterOperation,
precision, params.expected.dequantizationAfter);
shape,
epsMode,
params.expected);
} }
static std::string getTestCaseName(testing::TestParamInfo<NormalizeL2TransformationParams> obj) { static std::string getTestCaseName(testing::TestParamInfo<NormalizeL2TransformationParams> obj) {
ngraph::element::Type precision;
ngraph::Shape shape; ngraph::Shape shape;
ngraph::Shape axes; ngraph::Shape axes;
ngraph::op::EpsMode epsMode; ngraph::op::EpsMode epsMode;
NormalizeL2TransformationTestValues params; NormalizeL2TransformationTestValues params;
std::tie(precision, shape, epsMode, params) = obj.param; std::tie(shape, epsMode, axes, params) = obj.param;
std::ostringstream result; std::ostringstream result;
result << toString(params.transformationParams) << precision << "_" << shape << "_" << result <<
axes << epsMode << params.actual << params.expected; toString(params.transformationParams) << shape << "_" <<
axes << "_" << epsMode << "_" << params.actual.inputPrecision << "_" <<
params.actual.dequantization;
return result.str(); return result.str();
} }
}; };
@ -87,13 +101,8 @@ TEST_P(NormalizeL2Transformation, CompareFunctions) {
ASSERT_TRUE(res.first) << res.second; ASSERT_TRUE(res.first) << res.second;
} }
const std::vector<ngraph::element::Type> precisions = {
ngraph::element::f32,
// ngraph::element::f16
};
const std::vector<ngraph::Shape> shapes = { const std::vector<ngraph::Shape> shapes = {
{ 1, 4, 16, 16 } { 1, 3, 16, 16 }
}; };
std::vector<ngraph::op::EpsMode> epsMode = { std::vector<ngraph::op::EpsMode> epsMode = {
@ -101,37 +110,151 @@ std::vector<ngraph::op::EpsMode> epsMode = {
ngraph::op::EpsMode::MAX ngraph::op::EpsMode::MAX
}; };
std::vector<std::vector<size_t>> axes = {
{ 1 },
{ 1, 2, 3 }
};
const std::vector<NormalizeL2TransformationTestValues> normalizeL2TransformationTestValues = { const std::vector<NormalizeL2TransformationTestValues> normalizeL2TransformationTestValues = {
{ // U8 per tensor quantization
LayerTransformation::createParamsU8I8().setSupportAsymmetricQuantization(false),
{ ngraph::element::u8, { 1 }, { 2.f }, { -12.3f, -12.3f, -12.3f, -12.3f }},
{ ngraph::element::u8, { 1 }, { 2.f }, { -1.f, -1.f, -1.f, -1.f}}
},
// U8
{ {
LayerTransformation::createParamsU8I8(), LayerTransformation::createParamsU8I8(),
{ ngraph::element::u8, { 1 }, { 2.f }, { -12.3f, -12.3f, -12.3f, -12.3f }}, {
{ ngraph::element::u8, { 1 }, { 2.f }, { -1.f, -1.f, -1.f, -1.f}} ngraph::element::u8,
{{ngraph::element::f32}, {2.f}, {-12.3f}}
},
{
ngraph::element::u8,
{{ngraph::element::f32}, {2.f}, {-12.3f}},
ngraph::element::f32,
{}
}
}, },
// U8 per tensor quantization without subtract
{ {
LayerTransformation::createParamsU8I8(), LayerTransformation::createParamsU8I8(),
{ ngraph::element::u8, { 1, 2, 3 }, { }, { 12.3f }}, {
{ ngraph::element::u8, { 1, 2, 3 }, { }, { 1.f }} ngraph::element::u8,
{{ngraph::element::f32}, {}, {-12.3f}}
},
{
ngraph::element::u8,
{},
ngraph::element::f32,
{{}, {}, {-1.f}}
}
}, },
// U8 per channel quantization with the same values
// I8 {
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{12.3f, 12.3f, 12.3f}}}
},
{
ngraph::element::u8,
{},
ngraph::element::f32,
{{}, {}, {{1.f, 1.f, 1.f}}}
}
},
// U8 per channel quantization with different values
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{12.3f, -12.3f, 12.3f}}}
},
{
ngraph::element::u8,
{{ngraph::element::f32}, {}, {{12.3f, -12.3f, 12.3f}}},
ngraph::element::f32,
{}
}
},
// U8 not update precisions
{
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
{
ngraph::element::f32,
{{}, {}, {12.3f}}
},
{
ngraph::element::f32,
{},
ngraph::element::f32,
{{}, {}, {1.f}}
}
},
// U8 without dequantization
{
LayerTransformation::createParamsU8I8(),
{
ngraph::element::f32,
{}
},
{
ngraph::element::f32,
{},
ngraph::element::f32,
{}
}
},
// I8 per tensor quantization
{ {
LayerTransformation::createParamsI8I8(), LayerTransformation::createParamsI8I8(),
{ ngraph::element::i8, { 1 }, { 2.f }, { -12.3f, -12.3f, -12.3f, -12.3f }}, {
{ ngraph::element::i8, { 1 }, { 2.f }, { -1.f, -1.f, -1.f, -1.f}} ngraph::element::i8,
{{ngraph::element::f32}, {2.f}, {-12.3f}}
},
{
ngraph::element::i8,
{{ngraph::element::f32}, {2.f}, {-12.3f}},
ngraph::element::f32,
{}
}
}, },
// I8 per tensor quantization without subtract
{ {
LayerTransformation::createParamsI8I8(), LayerTransformation::createParamsI8I8(),
{ ngraph::element::i8, { 1, 2, 3 }, { }, { 12.3f }}, {
{ ngraph::element::i8, { 1, 2, 3 }, { }, { 1.f }} ngraph::element::i8,
{{ngraph::element::f32}, {}, {-12.3f}}
},
{
ngraph::element::i8,
{},
ngraph::element::f32,
{{}, {}, {-1.f}}
}
},
// I8 per channel quantization with the same values
{
LayerTransformation::createParamsI8I8(),
{
ngraph::element::i8,
{{ngraph::element::f32}, {}, {{12.3f, 12.3f, 12.3f}}}
},
{
ngraph::element::i8,
{},
ngraph::element::f32,
{{}, {}, {{1.f, 1.f, 1.f}}}
}
},
// I8 per channel quantization with different values
{
LayerTransformation::createParamsI8I8(),
{
ngraph::element::i8,
{{ngraph::element::f32}, {}, {{12.3f, -12.3f, 12.3f}}}
},
{
ngraph::element::i8,
{{ngraph::element::f32}, {}, {{12.3f, -12.3f, 12.3f}}},
ngraph::element::f32,
{}
}
}, },
}; };
@ -139,8 +262,8 @@ INSTANTIATE_TEST_CASE_P(
smoke_LPT, smoke_LPT,
NormalizeL2Transformation, NormalizeL2Transformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions),
::testing::ValuesIn(shapes), ::testing::ValuesIn(shapes),
::testing::ValuesIn(epsMode), ::testing::ValuesIn(epsMode),
::testing::ValuesIn(axes),
::testing::ValuesIn(normalizeL2TransformationTestValues)), ::testing::ValuesIn(normalizeL2TransformationTestValues)),
NormalizeL2Transformation::getTestCaseName); NormalizeL2Transformation::getTestCaseName);

View File

@ -30,7 +30,9 @@ public:
class Expected { class Expected {
public: public:
ngraph::element::Type precision; ngraph::element::Type inputPrecision;
ngraph::builder::subgraph::DequantizationOperations dequantizationBefore;
ngraph::element::Type precisionAfterOperation;
std::vector<ngraph::builder::subgraph::DequantizationOperations> dequantizationAfter; std::vector<ngraph::builder::subgraph::DequantizationOperations> dequantizationAfter;
}; };
@ -73,7 +75,9 @@ public:
referenceFunction = ngraph::builder::subgraph::SplitFunction::getReference( referenceFunction = ngraph::builder::subgraph::SplitFunction::getReference(
testValues.inputShape, testValues.inputShape,
testValues.expected.precision, testValues.expected.inputPrecision,
testValues.expected.dequantizationBefore,
testValues.expected.precisionAfterOperation,
testValues.expected.dequantizationAfter, testValues.expected.dequantizationAfter,
testValues.splitedAxis, testValues.splitedAxis,
testValues.numSplits); testValues.numSplits);
@ -114,6 +118,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
}, },
// ExpectedValues // ExpectedValues
{ {
ngraph::element::u8,
{},
ngraph::element::u8, ngraph::element::u8,
{ {
{{ngraph::element::f32}, {128.f}, {3.f}}, {{ngraph::element::f32}, {128.f}, {3.f}},
@ -131,6 +137,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
}, },
{ {
ngraph::element::i8, ngraph::element::i8,
{},
ngraph::element::u8,
{ {
{{ngraph::element::f32}, {128.f}, {3.f}}, {{ngraph::element::f32}, {128.f}, {3.f}},
{{ngraph::element::f32}, {128.f}, {3.f}}, {{ngraph::element::f32}, {128.f}, {3.f}},
@ -148,6 +156,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::u8,
{},
ngraph::element::u8, ngraph::element::u8,
{ {
{ {
@ -179,6 +189,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::i8,
{},
ngraph::element::i8, ngraph::element::i8,
{ {
{ {
@ -210,6 +222,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
{{11.f, 11.f, 11.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 11.f, 11.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::u8,
{},
ngraph::element::u8, ngraph::element::u8,
{ {
{ {
@ -241,6 +255,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
{{11.f, 11.f, 11.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 11.f, 11.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::i8,
{},
ngraph::element::i8, ngraph::element::i8,
{ {
{ {
@ -272,6 +288,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::u8,
{},
ngraph::element::u8, ngraph::element::u8,
{ {
{ {
@ -303,6 +321,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::i8,
{},
ngraph::element::i8, ngraph::element::i8,
{ {
{ {
@ -334,6 +354,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::u8,
{},
ngraph::element::u8, ngraph::element::u8,
{ {
{ {
@ -365,6 +387,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::i8,
{},
ngraph::element::i8, ngraph::element::i8,
{ {
{ {
@ -396,6 +420,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f, 44.f}, ngraph::element::f32, {1, 4, 1, 1}}} {{11.f, 22.f, 33.f, 44.f}, ngraph::element::f32, {1, 4, 1, 1}}}
}, },
{ {
ngraph::element::i8,
{},
ngraph::element::i8, ngraph::element::i8,
{ {
{ {
@ -422,6 +448,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f, 44.f}, ngraph::element::f32, {1, 4, 1, 1}}} {{11.f, 22.f, 33.f, 44.f}, ngraph::element::f32, {1, 4, 1, 1}}}
}, },
{ {
ngraph::element::f32,
{},
ngraph::element::f32, ngraph::element::f32,
{ {
{ {

View File

@ -30,7 +30,9 @@ public:
class Expected { class Expected {
public: public:
ngraph::element::Type precision; ngraph::element::Type inputPrecision;
ngraph::builder::subgraph::DequantizationOperations dequantizationBefore;
ngraph::element::Type precisionAfterOperation;
std::vector<ngraph::builder::subgraph::DequantizationOperations> dequantizationAfter; std::vector<ngraph::builder::subgraph::DequantizationOperations> dequantizationAfter;
}; };
@ -86,7 +88,9 @@ public:
referenceFunction = ngraph::builder::subgraph::VariadicSplitFunction::getReference( referenceFunction = ngraph::builder::subgraph::VariadicSplitFunction::getReference(
testValues.inputShape, testValues.inputShape,
testValues.expected.precision, testValues.expected.inputPrecision,
testValues.expected.dequantizationBefore,
testValues.expected.precisionAfterOperation,
testValues.expected.dequantizationAfter, testValues.expected.dequantizationAfter,
testValues.axis, testValues.axis,
testValues.splitLengths); testValues.splitLengths);
@ -126,6 +130,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
}, },
// ExpectedValues // ExpectedValues
{ {
ngraph::element::u8,
{},
ngraph::element::u8, ngraph::element::u8,
{ {
{{ngraph::element::f32}, {128.f}, {3.f}}, {{ngraph::element::f32}, {128.f}, {3.f}},
@ -142,6 +148,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
{{ngraph::element::f32}, {128.f}, {3.f}} {{ngraph::element::f32}, {128.f}, {3.f}}
}, },
{ {
ngraph::element::i8,
{},
ngraph::element::i8, ngraph::element::i8,
{ {
{{ngraph::element::f32}, {128.f}, {3.f}}, {{ngraph::element::f32}, {128.f}, {3.f}},
@ -160,6 +168,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::u8,
{},
ngraph::element::u8, ngraph::element::u8,
{ {
{ {
@ -186,6 +196,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::i8,
{},
ngraph::element::i8, ngraph::element::i8,
{ {
{ {
@ -212,6 +224,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
{{11.f, 11.f, 11.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 11.f, 11.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::u8,
{},
ngraph::element::u8, ngraph::element::u8,
{ {
{ {
@ -238,6 +252,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
{{11.f, 11.f, 11.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 11.f, 11.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::i8,
{},
ngraph::element::i8, ngraph::element::i8,
{ {
{ {
@ -262,6 +278,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
{{ngraph::element::f32}, {128.f}, {3.f}} {{ngraph::element::f32}, {128.f}, {3.f}}
}, },
{ {
ngraph::element::u8,
{},
ngraph::element::u8, ngraph::element::u8,
{ {
{{ngraph::element::f32}, {128.f}, {3.f}}, {{ngraph::element::f32}, {128.f}, {3.f}},
@ -279,6 +297,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
{{ngraph::element::f32}, {128.f}, {3.f}} {{ngraph::element::f32}, {128.f}, {3.f}}
}, },
{ {
ngraph::element::i8,
{},
ngraph::element::i8, ngraph::element::i8,
{ {
{{ngraph::element::f32}, {128.f}, {3.f}}, {{ngraph::element::f32}, {128.f}, {3.f}},
@ -298,6 +318,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f, 44.f}, ngraph::element::f32, {1, 4, 1, 1}}} {{11.f, 22.f, 33.f, 44.f}, ngraph::element::f32, {1, 4, 1, 1}}}
}, },
{ {
ngraph::element::i8,
{},
ngraph::element::i8, ngraph::element::i8,
{ {
{ {
@ -329,6 +351,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::u8,
{},
ngraph::element::u8, ngraph::element::u8,
{ {
{ {
@ -360,6 +384,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}} {{11.f, 22.f, 33.f}, ngraph::element::f32, {1, 3, 1, 1}}}
}, },
{ {
ngraph::element::i8,
{},
ngraph::element::i8, ngraph::element::i8,
{ {
{ {
@ -391,6 +417,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f, 44.f}, ngraph::element::f32, {1, 4, 1, 1}}} {{11.f, 22.f, 33.f, 44.f}, ngraph::element::f32, {1, 4, 1, 1}}}
}, },
{ {
ngraph::element::i8,
{},
ngraph::element::i8, ngraph::element::i8,
{ {
{ {
@ -417,6 +445,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
{{11.f, 22.f, 33.f, 44.f}, ngraph::element::f32, {1, 4, 1, 1}}} {{11.f, 22.f, 33.f, 44.f}, ngraph::element::f32, {1, 4, 1, 1}}}
}, },
{ {
ngraph::element::f32,
{},
ngraph::element::f32, ngraph::element::f32,
{ {
{ {

View File

@ -19,48 +19,48 @@ const std::vector<ngraph::element::Type> netPrecisions = {
const std::vector<LayerTestsDefinitions::AddTestValues> params = { const std::vector<LayerTestsDefinitions::AddTestValues> params = {
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.8f }, { 12.7f } },
false, false,
{ngraph::element::i8}, {ngraph::element::f32, ngraph::element::i8} {ngraph::element::i8}, {ngraph::element::f32, ngraph::element::i8}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
false, false,
{ngraph::element::i8}, {ngraph::element::f32, ngraph::element::i8} {ngraph::element::i8}, {ngraph::element::f32, ngraph::element::i8}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } },
true, true,
{ngraph::element::i8}, {ngraph::element::i8, ngraph::element::f32} {ngraph::element::i8}, {ngraph::element::i8, ngraph::element::f32}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -12.8f }, { 12.7f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
true, true,
{ngraph::element::i8}, {ngraph::element::i8, ngraph::element::f32} {ngraph::element::i8}, {ngraph::element::i8, ngraph::element::f32}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -127.f }, { 128.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.7f }, { 12.8f } },
false, false,
{ngraph::element::u8}, {ngraph::element::f32, ngraph::element::u8} {ngraph::element::u8}, {ngraph::element::f32, ngraph::element::u8}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
false, false,
{ngraph::element::u8}, {ngraph::element::f32, ngraph::element::u8} {ngraph::element::u8}, {ngraph::element::f32, ngraph::element::u8}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -127.f }, { 128.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -127.f }, { 128.f } },
true, true,
{ngraph::element::u8}, {ngraph::element::u8, ngraph::element::f32} {ngraph::element::u8}, {ngraph::element::u8, ngraph::element::f32}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -12.8f }, { 12.7f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
true, true,
{ngraph::element::u8}, {ngraph::element::u8, ngraph::element::f32} {ngraph::element::u8}, {ngraph::element::u8, ngraph::element::f32}

View File

@ -45,7 +45,8 @@ const std::vector<ConcatWithSplitTransformationParam> testValues = {
} }
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, ConcatWithSplitTransformation, // TODO: Split/VariadicSplit operations are not supported in ConcatTransformation
INSTANTIATE_TEST_CASE_P(DISABLED_smoke_LPT, ConcatWithSplitTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(ngraph::Shape({ 1, 6, 10, 10 })), ::testing::Values(ngraph::Shape({ 1, 6, 10, 10 })),

View File

@ -11,16 +11,16 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
// InferenceEngine::Precision::FP16 // ngraph::element::f16
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<ngraph::pass::low_precision::LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
}; };
const std::vector<ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::ActualValues> testValues = { const std::vector<FakeQuantizeAndTwoOutputBranchesWithConvolution> testValues = {
{ {
{ 256ul, {}, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, { 256ul, {}, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } },
{ 255ul, {1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f } }, { 255ul, {1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f } },
@ -32,7 +32,7 @@ const std::vector<ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWit
INSTANTIATE_TEST_CASE_P(smoke_LPT, FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 32, 72, 48 })), ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })),
::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),

View File

@ -12,13 +12,13 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
// InferenceEngine::Precision::FP16 // ngraph::element::f16
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
}; };
const std::vector<FakeQuantizePrecisionSelectionTransformationTestValues> testValues = { const std::vector<FakeQuantizePrecisionSelectionTransformationTestValues> testValues = {
@ -59,7 +59,7 @@ const std::vector<FakeQuantizePrecisionSelectionTransformationTestValues> testVa
INSTANTIATE_TEST_CASE_P(smoke_LPT, FakeQuantizePrecisionSelectionTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, FakeQuantizePrecisionSelectionTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 32, 72, 48 })), ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })),
::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),

View File

@ -12,17 +12,17 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
// InferenceEngine::Precision::FP16 // ngraph::element::f16
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
// can not be passed to plugin // can not be passed to plugin
// nGraph: I8 -> FP32 Convert is not supported // nGraph: I8 -> FP32 Convert is not supported
// LayerTestsUtils::LayerTransformationParamsFactory::createParams(), // LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams(),
// LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8(), // LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8(),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
}; };
const std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> fakeQuantizeOnDataValues = { const std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> fakeQuantizeOnDataValues = {
@ -38,7 +38,7 @@ const std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> fakeQuantizeOnD
INSTANTIATE_TEST_CASE_P(smoke_LPT, FakeQuantizeTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, FakeQuantizeTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 32, 72, 48 })), ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })),
::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(fakeQuantizeOnDataValues)), ::testing::ValuesIn(fakeQuantizeOnDataValues)),

View File

@ -12,12 +12,12 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32 ngraph::element::f32
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
}; };
const std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> fakeQuantizeOnDataValues = { const std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> fakeQuantizeOnDataValues = {
@ -36,7 +36,7 @@ const std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> fakeQuantizeOnD
INSTANTIATE_TEST_CASE_P(smoke_LPT, FuseFakeQuantizeAndScaleShiftTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, FuseFakeQuantizeAndScaleShiftTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 9, 9 })), ::testing::Values(ngraph::Shape({ 1, 3, 9, 9 })),
::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(fakeQuantizeOnDataValues)), ::testing::ValuesIn(fakeQuantizeOnDataValues)),

View File

@ -11,20 +11,20 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
InferenceEngine::Precision::FP16 // ngraph::element::f16
}; };
const std::vector<InferenceEngine::SizeVector> dimensions = { const std::vector<ngraph::Shape> dimensions = {
InferenceEngine::SizeVector({ 1, 3, 16, 16 }) { 1, 3, 16, 16 }
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParams().setSupportAsymmetricQuantization(true), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setSupportAsymmetricQuantization(true),
LayerTestsUtils::LayerTransformationParamsFactory::createParams().setSupportAsymmetricQuantization(false), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setSupportAsymmetricQuantization(false),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8(), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8(),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, GemmTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, GemmTransformation,

View File

@ -99,16 +99,10 @@ std::shared_ptr<InferenceEngine::ICNNNetwork> convert(std::shared_ptr<ngraph::Fu
std::shared_ptr<ngraph::Function> LayerTransformation::transformNGraph( std::shared_ptr<ngraph::Function> LayerTransformation::transformNGraph(
const ngraph::pass::low_precision::LayerTransformation::Params& params, const ngraph::pass::low_precision::LayerTransformation::Params& params,
const ngraph::pass::low_precision::LowPrecisionTransformations additionalTransformations) { const ngraph::pass::low_precision::LowPrecisionTransformations& transformations) {
std::shared_ptr<InferenceEngine::ICNNNetwork> clonedNetwork = convert(function); std::shared_ptr<InferenceEngine::ICNNNetwork> clonedNetwork = convert(function);
auto nGraphFunc = clonedNetwork->getFunction(); auto nGraphFunc = clonedNetwork->getFunction();
auto transformations = getLowPrecisionTransformationsNGraph(params);
for (auto& additionalTransformation : additionalTransformations.transformations) {
transformations.transformations.emplace(additionalTransformation.first, additionalTransformation.second);
}
ngraph::pass::low_precision::LowPrecisionTransformer transformer(transformations); ngraph::pass::low_precision::LowPrecisionTransformer transformer(transformations);
transformer.transform(nGraphFunc); transformer.transform(nGraphFunc);

View File

@ -10,8 +10,8 @@
using namespace LayerTestsDefinitions; using namespace LayerTestsDefinitions;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32 ngraph::element::f32
}; };
const std::vector<LayerTestsDefinitions::MatMulWithOptimizedConstantFakeQuantizeTransformationTestValues> params = { const std::vector<LayerTestsDefinitions::MatMulWithOptimizedConstantFakeQuantizeTransformationTestValues> params = {
@ -21,9 +21,9 @@ const std::vector<LayerTestsDefinitions::MatMulWithOptimizedConstantFakeQuantize
}, },
}; };
const std::vector<std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>> inputShapes = { const std::vector<std::pair<ngraph::Shape, ngraph::Shape>> inputShapes = {
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>({ InferenceEngine::SizeVector({ 1, 16 }), InferenceEngine::SizeVector({ 10, 16 }) }), std::pair<ngraph::Shape, ngraph::Shape>({ 1, 16 }, { 10, 16 }),
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>({ InferenceEngine::SizeVector({ 1, 16 }), InferenceEngine::SizeVector({ 16, 10 }) }) std::pair<ngraph::Shape, ngraph::Shape>({ 1, 16 }, { 16, 10 })
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, MatMulWithOptimizedConstantFakeQuantizeTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, MatMulWithOptimizedConstantFakeQuantizeTransformation,

View File

@ -10,9 +10,9 @@
using namespace LayerTestsDefinitions; using namespace LayerTestsDefinitions;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
// InferenceEngine::Precision::FP16 // ngraph::element::f16
}; };
const std::vector<MultiplyWithOneParentTransformationValues> values = { const std::vector<MultiplyWithOneParentTransformationValues> values = {
@ -24,7 +24,7 @@ const std::vector<MultiplyWithOneParentTransformationValues> values = {
INSTANTIATE_TEST_CASE_P(smoke_LPT, MultiplyWithOneParentTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, MultiplyWithOneParentTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(values)), ::testing::ValuesIn(values)),
MultiplyWithOneParentTransformation::getTestCaseName); MultiplyWithOneParentTransformation::getTestCaseName);

View File

@ -15,18 +15,18 @@ const std::vector<ngraph::element::Type> precisions = {
ngraph::element::f32 ngraph::element::f32
}; };
std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> testValues = { std::vector<PReluTestValues> testValues = {
{}, { {}, false},
{ 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }, { { 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }, false },
{ 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} }, { { 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} }, true },
{ 256ul, ngraph::Shape({}), {12.75f}, {25.5f}, {12.75f}, {25.5f} }, { { 256ul, ngraph::Shape({}), {12.75f}, {25.5f}, {12.75f}, {25.5f} }, true },
{ 256ul, ngraph::Shape({}), {-12.8f / 2.f}, {12.7f}, {-12.8f / 2.f}, {12.7f} } { { 256ul, ngraph::Shape({}), {-12.8f / 2.f}, {12.7f}, {-12.8f / 2.f}, {12.7f} }, true }
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, PReluTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, PReluTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(precisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),
PReluTransformation::getTestCaseName); PReluTransformation::getTestCaseName);

View File

@ -16,12 +16,12 @@ const std::vector<ngraph::element::Type> precisions = {
// ngraph::element::f16 // ngraph::element::f16
}; };
std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> testValues = { std::vector<ReluTestValues> testValues = {
{}, { {}, false},
{ 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }, { { 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }, false },
{ 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} }, { { 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} }, true },
{ 256ul, ngraph::Shape({}), {12.75f}, {25.5f}, {12.75f}, {25.5f} }, { { 256ul, ngraph::Shape({}), {12.75f}, {25.5f}, {12.75f}, {25.5f} }, true },
{ 256ul, ngraph::Shape({}), {-12.8f / 2.f}, {12.7f}, {-12.8f / 2.f}, {12.7f} } { { 256ul, ngraph::Shape({}), {-12.8f / 2.f}, {12.7f}, {-12.8f / 2.f}, {12.7f} }, true }
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, ReluTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, ReluTransformation,

View File

@ -27,18 +27,21 @@ const std::vector<ReshapeTransformationParam> params = {
ngraph::Shape{ 1, 3, 32 }, ngraph::Shape{ 1, 3, 32 },
{ 1, 3, 4, 8 }, { 1, 3, 4, 8 },
{ 256ul, ngraph::Shape{ 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, { 256ul, ngraph::Shape{ 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
true
}, },
// 4D -> 3D // 4D -> 3D
{ {
ngraph::Shape{ 1, 3, 16, 16 }, ngraph::Shape{ 1, 3, 16, 16 },
{ 1, 3, 256 }, { 1, 3, 256 },
{ 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
true
}, },
// 4D -> 2D // 4D -> 2D
{ {
ngraph::Shape{ 1, 3, 4, 8 }, ngraph::Shape{ 1, 3, 4, 8 },
{ 1, -1 }, { 1, -1 },
{ 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
true
}, },
}; };

View File

@ -11,36 +11,36 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> precisions = { const std::vector<ngraph::element::Type> precisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8(), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(false), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(false),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(true), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(true),
}; };
const std::vector<LayerTestsDefinitions::SqueezeTransformationParam> params = { const std::vector<LayerTestsDefinitions::SqueezeTransformationParam> params = {
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0, 3 }, { 3 },
{ 1, 3, 5, 1} { 1, 3, 5, 1}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0, 1, 2 }, { 2, 3 },
{ 1, 1, 1, 1 } { 1, 1, 1, 1 }
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0, 3 }, { 3 },
{ 1, 64, 32, 1 } { 1, 64, 32, 1 }
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 2.0, 3.0 }, { 2.0, 3.0 },
{ 1, 32, 1, 1 } { 1, 32, 1, 1 }
} }
}; };

View File

@ -44,19 +44,18 @@ const std::vector<SubtractMultiplyToMultiplyAddTransformationTestValues> testVal
{2.55f, 2.55f / 2.f, 2.55f / 3.f} {2.55f, 2.55f / 2.f, 2.55f / 3.f}
}, },
}, },
// TODO: uncomment test {
//{ {1, 3, 16, 16},
// {1, 3, 16, 16}, ngraph::element::f32,
// ngraph::element::f32, {
// { 256ul,
// 256ul, ngraph::Shape({1}),
// ngraph::Shape({1}), {2.55f / 2},
// {2.55f / 2}, {2.55f},
// {2.55f}, {2.55f / 2},
// {2.55f / 2}, {2.55f}
// {2.55f} },
// }, },
//},
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, SubtractMultiplyToMultiplyAddTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, SubtractMultiplyToMultiplyAddTransformation,

View File

@ -11,21 +11,21 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
InferenceEngine::Precision::FP16 ngraph::element::f16
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParams().setUpdatePrecisions(true), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setUpdatePrecisions(true),
LayerTestsUtils::LayerTransformationParamsFactory::createParams().setUpdatePrecisions(false), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setUpdatePrecisions(false),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, SubtractTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, SubtractTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(trasformationParamValues)), ::testing::ValuesIn(trasformationParamValues)),
SubtractTransformation::getTestCaseName); SubtractTransformation::getTestCaseName);

View File

@ -11,15 +11,15 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
InferenceEngine::Precision::FP16 // ngraph::element::f16
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParams().setUpdatePrecisions(true), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setUpdatePrecisions(true),
LayerTestsUtils::LayerTransformationParamsFactory::createParams().setUpdatePrecisions(false), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setUpdatePrecisions(false),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
}; };
const std::vector<bool> perTensorValues = { true, false }; const std::vector<bool> perTensorValues = { true, false };
@ -29,7 +29,7 @@ const std::vector<bool> transposeChannelDimValues = { true, false };
INSTANTIATE_TEST_CASE_P(smoke_LPT, TransposeAfterMatMulTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, TransposeAfterMatMulTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::Values(CommonTestUtils::DEVICE_CPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(perTensorValues), ::testing::ValuesIn(perTensorValues),

View File

@ -11,42 +11,42 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> precisions = { const std::vector<ngraph::element::Type> precisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8(), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(false), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(false),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(true), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(true),
}; };
const std::vector<LayerTestsDefinitions::UnsqueezeTransformationParam> params = { const std::vector<LayerTestsDefinitions::UnsqueezeTransformationParam> params = {
{ {
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } }, { 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 3.0 }, { 3.0 },
{ 3, 3, 5} { 3, 3, 5}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.8f }, { 12.7f } },
{ 0.0, 1.0 }, { 3.0 },
{ 3, 3, 3 } { 3, 3, 3, 5 }
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 3.0 }, { 3.0 },
{ 3, 4, 5, 6 } { 3, 4, 5, 6 }
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } }, { 256ul, ngraph::Shape { 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 3.0 }, { 2.0, 3.0 },
{ 1, 32, 2} { 3, 4 }
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 1.0 }, { 4.0 },
{ 46, 128, 2 } { 46, 128, 2, 3 }
} }
}; };

View File

@ -19,48 +19,48 @@ const std::vector<ngraph::element::Type> netPrecisions = {
const std::vector<LayerTestsDefinitions::AddTestValues> params = { const std::vector<LayerTestsDefinitions::AddTestValues> params = {
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.8f }, { 12.7f } },
false, false,
{ngraph::element::i8}, {ngraph::element::f32, ngraph::element::i8} {ngraph::element::i8}, {ngraph::element::f32, ngraph::element::i8}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
false, false,
{ngraph::element::i8}, {ngraph::element::f32, ngraph::element::i8} {ngraph::element::i8}, {ngraph::element::f32, ngraph::element::i8}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } },
true, true,
{ngraph::element::i8}, {ngraph::element::i8, ngraph::element::f32} {ngraph::element::i8}, {ngraph::element::i8, ngraph::element::f32}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -12.8f }, { 12.7f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
true, true,
{ngraph::element::i8}, {ngraph::element::i8, ngraph::element::f32} {ngraph::element::i8}, {ngraph::element::i8, ngraph::element::f32}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -127.f }, { 128.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.7f }, { 12.8f } },
false, false,
{ngraph::element::u8}, {ngraph::element::f32, ngraph::element::u8} {ngraph::element::u8}, {ngraph::element::f32, ngraph::element::u8}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
false, false,
{ngraph::element::u8}, {ngraph::element::f32, ngraph::element::u8} {ngraph::element::u8}, {ngraph::element::f32, ngraph::element::u8}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -127.f }, { 128.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -127.f }, { 128.f } },
true, true,
{ngraph::element::u8}, {ngraph::element::u8, ngraph::element::f32} {ngraph::element::u8}, {ngraph::element::u8, ngraph::element::f32}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -128.f }, { 127.f }, { -12.8f }, { 12.7f } },
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
true, true,
{ngraph::element::u8}, {ngraph::element::u8, ngraph::element::f32} {ngraph::element::u8}, {ngraph::element::u8, ngraph::element::f32}
@ -71,7 +71,7 @@ const std::vector<LayerTestsDefinitions::AddTestValues> params = {
INSTANTIATE_TEST_CASE_P(smoke_LPT, AddTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, AddTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(params)), ::testing::ValuesIn(params)),
AddTransformation::getTestCaseName); AddTransformation::getTestCaseName);

View File

@ -45,7 +45,8 @@ const std::vector<ConcatWithSplitTransformationParam> testValues = {
} }
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, ConcatWithSplitTransformation, // TODO: Split/VariadicSplit operations are not supported in ConcatTransformation
INSTANTIATE_TEST_CASE_P(DISABLED_smoke_LPT, ConcatWithSplitTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(ngraph::Shape({ 1, 6, 10, 10 })), ::testing::Values(ngraph::Shape({ 1, 6, 10, 10 })),

View File

@ -40,24 +40,18 @@ const std::vector<LayerTestsDefinitions::ConvolutionTransformationParam> params
{ 255ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 254.f }, { -12.7f }, { 12.7f } }, { 255ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 254.f }, { -12.7f }, { 12.7f } },
false false
}, },
// { {
// { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 1.f }, { 25.5f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.75f }, { 6.375f } },
// true, true,
// { 255ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 254.f }, { -12.7f }, { 12.7f } }, { 255ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 254.f }, { -12.7f }, { 12.7f } },
// false false
// }, }
// {
// { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
// false,
// { 255ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 254.f }, { -1.f }, { 12.7f } },
// true
// }
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, ConvolutionTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, ConvolutionTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(params)), ::testing::ValuesIn(params)),
@ -81,8 +75,8 @@ const std::vector<LayerTestsDefinitions::ConvolutionWIthIncorrectWeightsParam> i
INSTANTIATE_TEST_CASE_P(smoke_LPT, ConvolutionWIthIncorrectWeightsTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, ConvolutionWIthIncorrectWeightsTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(incorrectWeightsParams)), ::testing::ValuesIn(incorrectWeightsParams)),
ConvolutionWIthIncorrectWeightsTransformation::getTestCaseName); ConvolutionWIthIncorrectWeightsTransformation::getTestCaseName);

View File

@ -11,16 +11,16 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
// InferenceEngine::Precision::FP16 // ngraph::element::f16
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
}; };
const std::vector<ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::ActualValues> testValues = { const std::vector<FakeQuantizeAndTwoOutputBranchesWithConvolution> testValues = {
{ {
{ 256ul, {}, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, { 256ul, {}, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } },
{ 255ul, {1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f } }, { 255ul, {1, 1, 1, 1}, { 0.f }, { 254.f }, { -127.f }, { 127.f } },
@ -32,7 +32,7 @@ const std::vector<ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWit
INSTANTIATE_TEST_CASE_P(smoke_LPT, FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 32, 72, 48 })), ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),

View File

@ -12,13 +12,13 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
// InferenceEngine::Precision::FP16 // ngraph::element::f16
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
}; };
const std::vector<FakeQuantizePrecisionSelectionTransformationTestValues> testValues = { const std::vector<FakeQuantizePrecisionSelectionTransformationTestValues> testValues = {
@ -60,7 +60,7 @@ const std::vector<FakeQuantizePrecisionSelectionTransformationTestValues> testVa
INSTANTIATE_TEST_CASE_P(DISABLED_LPT, FakeQuantizePrecisionSelectionTransformation, INSTANTIATE_TEST_CASE_P(DISABLED_LPT, FakeQuantizePrecisionSelectionTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 32, 72, 48 })), ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),

View File

@ -12,17 +12,17 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
// InferenceEngine::Precision::FP16 // ngraph::element::f16
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
// can not be passed to plugin // can not be passed to plugin
// nGraph: I8 -> FP32 Convert is not supported // nGraph: I8 -> FP32 Convert is not supported
// LayerTestsUtils::LayerTransformationParamsFactory::createParams(), // LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams(),
// LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8(), // LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8(),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
}; };
const std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> fakeQuantizeOnDataValues = { const std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> fakeQuantizeOnDataValues = {
@ -37,7 +37,7 @@ const std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> fakeQuantizeOnD
INSTANTIATE_TEST_CASE_P(smoke_LPT, FakeQuantizeTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, FakeQuantizeTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 32, 72, 48 })), ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(fakeQuantizeOnDataValues)), ::testing::ValuesIn(fakeQuantizeOnDataValues)),

View File

@ -12,8 +12,8 @@ using namespace InferenceEngine::details;
namespace { namespace {
const std::vector<ngraph::element::Type> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
ngraph::element::f32, ngraph::element::f32,
// ngraph::element::f16 // ngraph::element::f16
}; };
const std::vector<MatMulShapes> shapes = { const std::vector<MatMulShapes> shapes = {

View File

@ -12,12 +12,12 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32 ngraph::element::f32,
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
}; };
const std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> fakeQuantizeOnDataValues = { const std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> fakeQuantizeOnDataValues = {
@ -36,7 +36,7 @@ const std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> fakeQuantizeOnD
INSTANTIATE_TEST_CASE_P(smoke_LPT, FuseFakeQuantizeAndScaleShiftTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, FuseFakeQuantizeAndScaleShiftTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 9, 9 })), ::testing::Values(ngraph::Shape({ 1, 3, 9, 9 })),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(fakeQuantizeOnDataValues)), ::testing::ValuesIn(fakeQuantizeOnDataValues)),

View File

@ -11,16 +11,16 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32 ngraph::element::f32,
}; };
const std::vector<InferenceEngine::SizeVector> dimensions = { const std::vector<ngraph::Shape> dimensions = {
InferenceEngine::SizeVector({ 1, 3, 16, 16 }) {1, 3, 16, 16}
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8()
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, GemmTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, GemmTransformation,

View File

@ -132,17 +132,12 @@ std::shared_ptr<InferenceEngine::ICNNNetwork> convert(std::shared_ptr<ngraph::Fu
std::shared_ptr<ngraph::Function> LayerTransformation::transformNGraph( std::shared_ptr<ngraph::Function> LayerTransformation::transformNGraph(
const ngraph::pass::low_precision::LayerTransformation::Params& params, const ngraph::pass::low_precision::LayerTransformation::Params& params,
const ngraph::pass::low_precision::LowPrecisionTransformations additionalTransformations) { const ngraph::pass::low_precision::LowPrecisionTransformations& transformations) {
std::shared_ptr<InferenceEngine::ICNNNetwork> clonedNetwork = convert(function); std::shared_ptr<InferenceEngine::ICNNNetwork> clonedNetwork = convert(function);
InferenceEngine::NetPass::ConvertPrecision(*clonedNetwork, InferenceEngine::Precision::FP16, InferenceEngine::Precision::FP32); InferenceEngine::NetPass::ConvertPrecision(*clonedNetwork, InferenceEngine::Precision::FP16, InferenceEngine::Precision::FP32);
auto nGraphFunc = clonedNetwork->getFunction(); auto nGraphFunc = clonedNetwork->getFunction();
auto transformations = getLowPrecisionTransformationsNGraph(params);
for (auto& additionalTransformation : additionalTransformations.transformations) {
transformations.transformations.emplace(additionalTransformation.first, additionalTransformation.second);
}
ngraph::pass::low_precision::LowPrecisionTransformer transformer(transformations); ngraph::pass::low_precision::LowPrecisionTransformer transformer(transformations);
transformer.transform(nGraphFunc); transformer.transform(nGraphFunc);

View File

@ -33,7 +33,7 @@ std::vector<MatMulTransformationTestValues> testValues = {
INSTANTIATE_TEST_CASE_P(smoke_LPT, MatMulTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, MatMulTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(precisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 384, 1024 })), ::testing::Values(ngraph::Shape({ 1, 384, 1024 })),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),
MatMulTransformation::getTestCaseName); MatMulTransformation::getTestCaseName);

View File

@ -10,8 +10,8 @@
using namespace LayerTestsDefinitions; using namespace LayerTestsDefinitions;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32 ngraph::element::f32,
}; };
const std::vector<LayerTestsDefinitions::MatMulWithOptimizedConstantFakeQuantizeTransformationTestValues> params = { const std::vector<LayerTestsDefinitions::MatMulWithOptimizedConstantFakeQuantizeTransformationTestValues> params = {
@ -21,9 +21,9 @@ const std::vector<LayerTestsDefinitions::MatMulWithOptimizedConstantFakeQuantize
}, },
}; };
const std::vector<std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>> inputShapes = { const std::vector<std::pair<ngraph::Shape, ngraph::Shape>> inputShapes = {
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>({ InferenceEngine::SizeVector({ 1, 16 }), InferenceEngine::SizeVector({ 10, 16 }) }), std::pair<ngraph::Shape, ngraph::Shape>({ 1, 16 }, { 10, 16 }),
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>({ InferenceEngine::SizeVector({ 1, 16 }), InferenceEngine::SizeVector({ 16, 10 }) }) std::pair<ngraph::Shape, ngraph::Shape>({ 1, 16 }, { 16, 10 })
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, MatMulWithOptimizedConstantFakeQuantizeTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, MatMulWithOptimizedConstantFakeQuantizeTransformation,

View File

@ -70,7 +70,7 @@ const std::vector<LayerTestsDefinitions::MultiplyTestValues> params = {
INSTANTIATE_TEST_CASE_P(smoke_LPT, MultiplyTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, MultiplyTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(params)), ::testing::ValuesIn(params)),
MultiplyTransformation::getTestCaseName); MultiplyTransformation::getTestCaseName);

View File

@ -10,9 +10,9 @@
using namespace LayerTestsDefinitions; using namespace LayerTestsDefinitions;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
// InferenceEngine::Precision::FP16 // ngraph::element::f16
}; };
const std::vector<MultiplyWithOneParentTransformationValues> values = { const std::vector<MultiplyWithOneParentTransformationValues> values = {

View File

@ -4,7 +4,7 @@
#include <vector> #include <vector>
#include "low_precision_transformations/relu_transformation.hpp" #include "low_precision_transformations/prelu_transformation.hpp"
#include "common_test_utils/test_constants.hpp" #include "common_test_utils/test_constants.hpp"
using namespace LayerTestsDefinitions; using namespace LayerTestsDefinitions;
@ -12,23 +12,22 @@ using namespace InferenceEngine::details;
namespace { namespace {
const std::vector<ngraph::element::Type> precisions = { const std::vector<ngraph::element::Type> precisions = {
ngraph::element::f32, ngraph::element::f32
// ngraph::element::f16
}; };
std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> testValues = { std::vector<PReluTestValues> testValues = {
{}, { {}, false},
{ 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }, { { 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }, false },
{ 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} }, { { 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} }, true },
{ 256ul, ngraph::Shape({}), {12.75f}, {25.5f}, {12.75f}, {25.5f} }, { { 256ul, ngraph::Shape({}), {12.75f}, {25.5f}, {12.75f}, {25.5f} }, true },
{ 256ul, ngraph::Shape({}), {-12.8f / 2.f}, {12.7f}, {-12.8f / 2.f}, {12.7f} } { { 256ul, ngraph::Shape({}), {-12.8f / 2.f}, {12.7f}, {-12.8f / 2.f}, {12.7f} }, true }
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, ReluTransformation, INSTANTIATE_TEST_CASE_P(LPT, PReluTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(precisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),
ReluTransformation::getTestCaseName); PReluTransformation::getTestCaseName);
} // namespace } // namespace

View File

@ -16,18 +16,18 @@ const std::vector<ngraph::element::Type> precisions = {
// ngraph::element::f16 // ngraph::element::f16
}; };
std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> testValues = { std::vector<ReluTestValues> testValues = {
{}, { {}, false},
{ 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }, { { 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }, false },
{ 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} }, { { 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} }, true },
{ 256ul, ngraph::Shape({}), {12.75f}, {25.5f}, {12.75f}, {25.5f} }, { { 256ul, ngraph::Shape({}), {12.75f}, {25.5f}, {12.75f}, {25.5f} }, true },
{ 256ul, ngraph::Shape({}), {-12.8f / 2.f}, {12.7f}, {-12.8f / 2.f}, {12.7f} } { { 256ul, ngraph::Shape({}), {-12.8f / 2.f}, {12.7f}, {-12.8f / 2.f}, {12.7f} }, true }
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, ReluTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, ReluTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(precisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(testValues)), ::testing::ValuesIn(testValues)),
ReluTransformation::getTestCaseName); ReluTransformation::getTestCaseName);

View File

@ -27,18 +27,21 @@ const std::vector<ReshapeTransformationParam> params = {
ngraph::Shape{ 1, 3, 32 }, ngraph::Shape{ 1, 3, 32 },
{ 1, 3, 4, 8 }, { 1, 3, 4, 8 },
{ 256ul, ngraph::Shape{ 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, { 256ul, ngraph::Shape{ 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
true
}, },
// 4D -> 3D // 4D -> 3D
{ {
ngraph::Shape{ 1, 3, 16, 16 }, ngraph::Shape{ 1, 3, 16, 16 },
{ 1, 3, 256 }, { 1, 3, 256 },
{ 256ul, ngraph::Shape{ 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
true
}, },
// 4D -> 2D // 4D -> 2D
{ {
ngraph::Shape{ 1, 3, 4, 8 }, ngraph::Shape{ 1, 3, 4, 8 },
{ 1, -1 }, { 1, -1 },
{ 256ul, ngraph::Shape{ 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
true
}, },
}; };

View File

@ -11,43 +11,43 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> precisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8(), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(false), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(false),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(true), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(true),
}; };
const std::vector<LayerTestsDefinitions::SqueezeTransformationParam> params = { const std::vector<LayerTestsDefinitions::SqueezeTransformationParam> params = {
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 3.0 }, { 3 },
{ 1, 3, 5, 1} { 1, 3, 5, 1}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 1.0, 2.0 }, { 2, 3 },
{ 1, 1, 1, 1 } { 1, 1, 1, 1 }
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 3.0 }, { 3 },
{ 1, 64, 32, 1 } { 1, 64, 32, 1 }
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 2.0, 3.0 }, { 2.0, 3.0 },
{ 1, 32, 1, 1 } { 1, 32, 1, 1 }
} }
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, SqueezeTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, SqueezeTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(params)), ::testing::ValuesIn(params)),

View File

@ -43,19 +43,18 @@ const std::vector<SubtractMultiplyToMultiplyAddTransformationTestValues> testVal
{2.55f, 2.55f / 2.f, 2.55f / 3.f} {2.55f, 2.55f / 2.f, 2.55f / 3.f}
}, },
}, },
// TODO: uncomment test {
// { {1, 3, 16, 16},
// {1, 3, 16, 16}, ngraph::element::f32,
// ngraph::element::f32, {
// { 256ul,
// 256ul, ngraph::Shape({1}),
// ngraph::Shape({1}), {2.55f / 2},
// {2.55f / 2}, {2.55f},
// {2.55f}, {2.55f / 2},
// {2.55f / 2}, {2.55f}
// {2.55f} },
// }, },
// },
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, SubtractMultiplyToMultiplyAddTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, SubtractMultiplyToMultiplyAddTransformation,

View File

@ -11,18 +11,18 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32 ngraph::element::f32,
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParams() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams()
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, SubtractTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, SubtractTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(trasformationParamValues)), ::testing::ValuesIn(trasformationParamValues)),
SubtractTransformation::getTestCaseName); SubtractTransformation::getTestCaseName);

View File

@ -11,12 +11,12 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32 ngraph::element::f32,
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParams() LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams()
}; };
const std::vector<bool> perTensorValues = { true, false }; const std::vector<bool> perTensorValues = { true, false };
@ -26,7 +26,7 @@ const std::vector<bool> transposeChannelDimValues = { true, false };
INSTANTIATE_TEST_CASE_P(smoke_LPT, TransposeAfterMatMulTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, TransposeAfterMatMulTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(perTensorValues), ::testing::ValuesIn(perTensorValues),

View File

@ -11,48 +11,48 @@ using namespace LayerTestsDefinitions;
using namespace ngraph::pass::low_precision; using namespace ngraph::pass::low_precision;
namespace { namespace {
const std::vector<InferenceEngine::Precision> precisions = { const std::vector<ngraph::element::Type> netPrecisions = {
InferenceEngine::Precision::FP32, ngraph::element::f32,
}; };
const std::vector<LayerTransformation::Params> trasformationParamValues = { const std::vector<LayerTransformation::Params> trasformationParamValues = {
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8(), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(false), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(false),
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(true), LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(true),
}; };
const std::vector<LayerTestsDefinitions::UnsqueezeTransformationParam> params = { const std::vector<LayerTestsDefinitions::UnsqueezeTransformationParam> params = {
{ {
{ 256ul, ngraph::Shape { 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 3.0 }, { 3.0 },
{ 3, 3, 5} { 3, 3, 5}
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.8f }, { 12.7f } },
{ 0.0, 1.0 }, { 3.0 },
{ 3, 3, 3 } { 3, 3, 3, 5 }
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 3.0 }, { 3.0 },
{ 3, 4, 5, 6 } { 3, 4, 5, 6 }
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 3.0 }, { 2.0, 3.0 },
{ 1, 32, 2} { 3, 4 }
}, },
{ {
{ 256ul, ngraph::Shape { 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } }, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
{ 0.0, 1.0 }, { 4.0 },
{ 46, 128, 2 } { 46, 128, 2, 3 }
} }
}; };
INSTANTIATE_TEST_CASE_P(smoke_LPT, UnsqueezeTransformation, INSTANTIATE_TEST_CASE_P(smoke_LPT, UnsqueezeTransformation,
::testing::Combine( ::testing::Combine(
::testing::ValuesIn(precisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::Values(CommonTestUtils::DEVICE_GPU),
::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(trasformationParamValues),
::testing::ValuesIn(params)), ::testing::ValuesIn(params)),

View File

@ -35,6 +35,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -33,6 +33,6 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private: private:
void validateNGraph(); void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -33,6 +33,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -35,6 +35,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -29,6 +29,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -26,6 +26,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -43,7 +43,7 @@ protected:
void Run() override; void Run() override;
private: private:
void validateNGraph(); void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -36,6 +36,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -27,6 +27,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -27,6 +27,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -13,13 +13,19 @@
#include "lpt_ngraph_functions/fake_quantize_and_two_output_branches_with_convolution_function.hpp" #include "lpt_ngraph_functions/fake_quantize_and_two_output_branches_with_convolution_function.hpp"
namespace LayerTestsDefinitions { namespace LayerTestsDefinitions {
class FakeQuantizeAndTwoOutputBranchesWithConvolution {
public:
ngraph::builder::subgraph::FakeQuantizeOnData fqOnData;
ngraph::builder::subgraph::FakeQuantizeOnWeights fqOnWeights1;
ngraph::builder::subgraph::FakeQuantizeOnWeights fqOnWeights2;
};
typedef std::tuple< typedef std::tuple<
InferenceEngine::Precision, ngraph::element::Type,
InferenceEngine::SizeVector, ngraph::Shape,
std::string, std::string,
ngraph::pass::low_precision::LayerTransformation::Params, ngraph::pass::low_precision::LayerTransformation::Params,
ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::ActualValues FakeQuantizeAndTwoOutputBranchesWithConvolution
> FakeQuantizeAndTwoOutputBranchesWithConvolutionParams; > FakeQuantizeAndTwoOutputBranchesWithConvolutionParams;
class FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation : class FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation :
@ -30,6 +36,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -49,8 +49,8 @@ inline std::ostream& operator<<(std::ostream& out, const FakeQuantizePrecisionSe
} }
typedef std::tuple< typedef std::tuple<
InferenceEngine::Precision, ngraph::element::Type,
InferenceEngine::SizeVector, ngraph::Shape,
std::string, std::string,
ngraph::pass::low_precision::LayerTransformation::Params, ngraph::pass::low_precision::LayerTransformation::Params,
FakeQuantizePrecisionSelectionTransformationTestValues> FakeQuantizeTransformationParams; FakeQuantizePrecisionSelectionTransformationTestValues> FakeQuantizeTransformationParams;
@ -63,6 +63,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -11,10 +11,9 @@
namespace LayerTestsDefinitions { namespace LayerTestsDefinitions {
// ngraph::builder::subgraph::FakeQuantizeOnData
typedef std::tuple< typedef std::tuple<
InferenceEngine::Precision, ngraph::element::Type,
InferenceEngine::SizeVector, ngraph::Shape,
std::string, std::string,
ngraph::pass::low_precision::LayerTransformation::Params, ngraph::pass::low_precision::LayerTransformation::Params,
ngraph::builder::subgraph::FakeQuantizeOnData> FakeQuantizeTransformationParams; ngraph::builder::subgraph::FakeQuantizeOnData> FakeQuantizeTransformationParams;
@ -27,6 +26,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -33,6 +33,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -12,8 +12,8 @@
namespace LayerTestsDefinitions { namespace LayerTestsDefinitions {
typedef std::tuple< typedef std::tuple<
InferenceEngine::Precision, ngraph::element::Type,
InferenceEngine::SizeVector, ngraph::Shape,
std::string, std::string,
ngraph::pass::low_precision::LayerTransformation::Params, ngraph::pass::low_precision::LayerTransformation::Params,
ngraph::builder::subgraph::FakeQuantizeOnData> FuseFakeQuantizeAndScaleShiftTransformationParams; ngraph::builder::subgraph::FakeQuantizeOnData> FuseFakeQuantizeAndScaleShiftTransformationParams;
@ -26,6 +26,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -43,6 +43,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -39,6 +39,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -39,6 +39,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -11,15 +11,24 @@
namespace LayerTestsDefinitions { namespace LayerTestsDefinitions {
typedef std::tuple<
ngraph::element::Type,
ngraph::Shape,
std::string,
ngraph::pass::low_precision::LayerTransformation::Params> GemmTransformationParams;
// TODO: use MatMulTransformation // TODO: use MatMulTransformation
class GemmTransformation : class GemmTransformation :
public testing::WithParamInterface<LayerTestsUtils::LayerTransformationParams>, public testing::WithParamInterface<GemmTransformationParams>,
public LayerTestsUtils::LayerTransformation { public LayerTestsUtils::LayerTransformation {
public: public:
static std::string getTestCaseName(testing::TestParamInfo<LayerTestsUtils::LayerTransformationParams> obj); static std::string getTestCaseName(testing::TestParamInfo<GemmTransformationParams> obj);
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -39,7 +39,7 @@ protected:
void SetUp() override; void SetUp() override;
private: private:
void validateNGraph(); void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -49,6 +49,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -36,6 +36,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -41,6 +41,9 @@ protected:
void SetUp() override; void SetUp() override;
void Run() override; void Run() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -19,8 +19,8 @@ public:
}; };
typedef std::tuple< typedef std::tuple<
InferenceEngine::Precision, ngraph::element::Type,
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>, std::pair<ngraph::Shape, ngraph::Shape>,
std::string, std::string,
MatMulWithOptimizedConstantFakeQuantizeTransformationTestValues MatMulWithOptimizedConstantFakeQuantizeTransformationTestValues
> MatMulWithOptimizedConstantFakeQuantizeTransformationTransformationParams; > MatMulWithOptimizedConstantFakeQuantizeTransformationTransformationParams;
@ -33,6 +33,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -36,6 +36,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -18,8 +18,8 @@ public:
}; };
typedef std::tuple< typedef std::tuple<
InferenceEngine::Precision, ngraph::element::Type,
InferenceEngine::SizeVector, ngraph::Shape,
std::string, std::string,
MultiplyWithOneParentTransformationValues MultiplyWithOneParentTransformationValues
> MultiplyWithOneParentTransformationParams; > MultiplyWithOneParentTransformationParams;

View File

@ -29,6 +29,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -28,6 +28,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -11,11 +11,17 @@
namespace LayerTestsDefinitions { namespace LayerTestsDefinitions {
class PReluTestValues {
public:
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize;
bool isSubtract;
};
typedef std::tuple< typedef std::tuple<
ngraph::element::Type, ngraph::element::Type,
ngraph::Shape, ngraph::Shape,
std::string, std::string,
ngraph::builder::subgraph::FakeQuantizeOnData> PReluTransformationParams; PReluTestValues> PReluTransformationParams;
class PReluTransformation : class PReluTransformation :
public testing::WithParamInterface<PReluTransformationParams>, public testing::WithParamInterface<PReluTransformationParams>,
@ -26,6 +32,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -11,11 +11,17 @@
namespace LayerTestsDefinitions { namespace LayerTestsDefinitions {
class ReluTestValues {
public:
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize;
bool isSubtract;
};
typedef std::tuple< typedef std::tuple<
ngraph::element::Type, ngraph::element::Type,
ngraph::Shape, ngraph::Shape,
std::string, std::string,
ngraph::builder::subgraph::FakeQuantizeOnData> ReluTransformationParams; ReluTestValues> ReluTransformationParams;
class ReluTransformation : class ReluTransformation :
public testing::WithParamInterface<ReluTransformationParams>, public testing::WithParamInterface<ReluTransformationParams>,
@ -26,6 +32,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -17,6 +17,7 @@ public:
ngraph::Shape inputShape; ngraph::Shape inputShape;
std::vector<int> reshapeConstValues; std::vector<int> reshapeConstValues;
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize;
bool isTransformed;
}; };
typedef std::tuple< typedef std::tuple<
@ -34,6 +35,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -33,6 +33,6 @@ protected:
void SetUp() override; void SetUp() override;
private: private:
void validateNGraph(); void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -22,7 +22,7 @@ public:
std::string stringifySqueezeArgs(const std::vector<float>& axes); std::string stringifySqueezeArgs(const std::vector<float>& axes);
typedef std::tuple< typedef std::tuple<
InferenceEngine::Precision, ngraph::element::Type,
std::string, std::string,
ngraph::pass::low_precision::LayerTransformation::Params, ngraph::pass::low_precision::LayerTransformation::Params,
SqueezeTransformationParam SqueezeTransformationParam
@ -37,6 +37,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -31,7 +31,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
void validateNGraph();
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -11,11 +11,18 @@
namespace LayerTestsDefinitions { namespace LayerTestsDefinitions {
typedef std::tuple<
ngraph::element::Type,
ngraph::Shape,
std::string,
ngraph::pass::low_precision::LayerTransformation::Params
> SubtractTransformationParams;
class SubtractTransformation : class SubtractTransformation :
public testing::WithParamInterface<LayerTestsUtils::LayerTransformationParams>, public testing::WithParamInterface<SubtractTransformationParams>,
public LayerTestsUtils::LayerTransformation { public LayerTestsUtils::LayerTransformation {
public: public:
static std::string getTestCaseName(testing::TestParamInfo<LayerTestsUtils::LayerTransformationParams> obj); static std::string getTestCaseName(testing::TestParamInfo<SubtractTransformationParams> obj);
protected: protected:
void SetUp() override; void SetUp() override;

View File

@ -12,8 +12,8 @@
namespace LayerTestsDefinitions { namespace LayerTestsDefinitions {
typedef std::tuple< typedef std::tuple<
InferenceEngine::Precision, ngraph::element::Type,
InferenceEngine::SizeVector, ngraph::Shape,
std::string, std::string,
ngraph::pass::low_precision::LayerTransformation::Params, ngraph::pass::low_precision::LayerTransformation::Params,
bool, bool,
@ -27,6 +27,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -34,6 +34,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -20,7 +20,7 @@ public:
}; };
typedef std::tuple< typedef std::tuple<
InferenceEngine::Precision, ngraph::element::Type,
std::string, std::string,
ngraph::pass::low_precision::LayerTransformation::Params, ngraph::pass::low_precision::LayerTransformation::Params,
UnsqueezeTransformationParam UnsqueezeTransformationParam
@ -35,6 +35,9 @@ public:
protected: protected:
void SetUp() override; void SetUp() override;
private:
void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

View File

@ -33,6 +33,6 @@ protected:
void SetUp() override; void SetUp() override;
private: private:
void validateNGraph(); void validate();
}; };
} // namespace LayerTestsDefinitions } // namespace LayerTestsDefinitions

Some files were not shown because too many files have changed in this diff Show More