* [LPT] ieFuncTests unification * [LPT] plugin tests unification * [LPT] added removeStandaloneCleanup && removeTransforamtions refactoring
This commit is contained in:
parent
eac33e1b0e
commit
5943e1be73
@ -39,10 +39,98 @@ public:
|
||||
void setUpdatePrecisions(const bool updatePrecisions);
|
||||
void setQuantizedTensorAlignmentOnActivations(const LayerTransformation::QuantizedTensorAlignment quantizedTensorAlignmentOnActivations);
|
||||
void setQuantizedTensorAlignmentOnWeights(const LayerTransformation::QuantizedTensorAlignment quantizedTensorAlignmentOnWeights);
|
||||
LowPrecisionTransformations& remove(const std::string& operationType);
|
||||
LowPrecisionTransformations& removeBranchSpecificTransformations(const std::string& operationType);
|
||||
LowPrecisionTransformations& removeTransformations(const std::string& operationType);
|
||||
LowPrecisionTransformations& removeCleanupTransformations(const std::string& operationType);
|
||||
|
||||
/**
|
||||
* Remove branch specific 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& 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.
|
||||
|
@ -290,7 +290,9 @@ void ConcatTransformation::addDequantizationLayers(
|
||||
for (size_t i = 0; i < layerDequantizations.size(); ++i) {
|
||||
const auto& dequantization = layerDequantizations[i];
|
||||
|
||||
if (dequantization.convert != nullptr) {
|
||||
convertNodes.push_back(dequantization.convert);
|
||||
}
|
||||
|
||||
const ngraph::element::Type precision = dequantization.data.get_element_type();
|
||||
ngraph::Shape targetShape = dequantization.data.get_shape();
|
||||
|
@ -678,9 +678,10 @@ FakeQuantizeDequantization NetworkHelper::makeDequantization(
|
||||
const std::shared_ptr<opset1::Parameter> input = std::make_shared<ngraph::opset1::Parameter>(precision, dataNodeOutputShape);
|
||||
std::shared_ptr<ngraph::Node> parent = input;
|
||||
|
||||
// TODO: convert should be optional: where is updatePrecision?
|
||||
std::shared_ptr<DequantizationConvert> convert;
|
||||
{
|
||||
if (precision == originalPrecision) {
|
||||
convert = nullptr;
|
||||
} else {
|
||||
convert = std::make_shared<DequantizationConvert>(
|
||||
input,
|
||||
originalPrecision);
|
||||
@ -742,21 +743,28 @@ FakeQuantizeDequantization NetworkHelper::createDequantizationFromFakeQuantize(
|
||||
}
|
||||
}
|
||||
|
||||
const auto input = std::make_shared<ngraph::opset1::Parameter>(precision, fq->get_output_shape(0));
|
||||
const std::shared_ptr<ngraph::opset1::Convert> convert = std::make_shared<DequantizationConvert>(
|
||||
input,
|
||||
fq->get_output_element_type(0));
|
||||
const auto input = std::make_shared<ngraph::opset1::Parameter>(
|
||||
updatePrecision ? precision : fq->get_output_element_type(0),
|
||||
fq->get_output_shape(0));
|
||||
std::shared_ptr<ngraph::Node> parent = input;
|
||||
|
||||
const std::shared_ptr<ngraph::opset1::Subtract> subtract = shift == nullptr ?
|
||||
nullptr :
|
||||
make_shared<ngraph::op::TypeRelaxed<DequantizationSubtract>>(convert, shift);
|
||||
if (subtract != nullptr) {
|
||||
subtract->set_output_type(0, fq->get_output_element_type(0), subtract->get_output_partial_shape(0));
|
||||
std::shared_ptr<ngraph::opset1::Convert> convert;
|
||||
if (updatePrecision) {
|
||||
convert = std::make_shared<DequantizationConvert>(parent, fq->get_output_element_type(0));
|
||||
parent = convert;
|
||||
} else {
|
||||
convert = nullptr;
|
||||
}
|
||||
|
||||
const std::shared_ptr<ngraph::opset1::Multiply> multiply = std::make_shared<DequantizationMultiply>(
|
||||
subtract == nullptr ? static_cast<std::shared_ptr<Node>>(convert) : subtract,
|
||||
scale);
|
||||
std::shared_ptr<ngraph::opset1::Subtract> subtract;
|
||||
if (shift != nullptr) {
|
||||
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);
|
||||
}
|
||||
|
@ -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 {
|
||||
auto it = branchSpecificTransformations.find(transformationKey);
|
||||
std::vector<LayerTransformationPtr> res;
|
||||
|
@ -18,19 +18,34 @@
|
||||
#include "common_test_utils/ngraph_test_utils.hpp"
|
||||
#include "simple_low_precision_transformer.hpp"
|
||||
#include "lpt_ngraph_functions/avg_pool_function.hpp"
|
||||
#include "lpt_ngraph_functions/common/dequantization_operations.hpp"
|
||||
|
||||
using namespace testing;
|
||||
using namespace ngraph::pass;
|
||||
|
||||
class AvgPoolTransformationTestValues {
|
||||
public:
|
||||
low_precision::LayerTransformation::Params params;
|
||||
std::vector<float> subtractValues;
|
||||
std::vector<float> mutliplyValues;
|
||||
public:
|
||||
class Actual {
|
||||
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<
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
bool, // additional FakeQuantize After
|
||||
std::string, // additional layer before FQ
|
||||
@ -39,22 +54,17 @@ typedef std::tuple<
|
||||
class AvgPoolTransformation : public LayerTransformation, public testing::WithParamInterface<AvgPoolTransformationParams> {
|
||||
public:
|
||||
void SetUp() override {
|
||||
const ngraph::element::Type precision = std::get<0>(GetParam());
|
||||
const ngraph::Shape shape = std::get<1>(GetParam());
|
||||
const bool addFQ = std::get<2>(GetParam());
|
||||
const std::string additionalLayer = std::get<3>(GetParam());
|
||||
const AvgPoolTransformationTestValues testValues = std::get<4>(GetParam());
|
||||
const ngraph::Shape shape = std::get<0>(GetParam());
|
||||
const bool addFakeQuantize = std::get<1>(GetParam());
|
||||
const std::string additionalLayer = std::get<2>(GetParam());
|
||||
const AvgPoolTransformationTestValues testValues = std::get<3>(GetParam());
|
||||
|
||||
actualFunction = ngraph::builder::subgraph::AvgPoolFunction::getOriginal(
|
||||
precision,
|
||||
testValues.actual.inputPrecision,
|
||||
shape,
|
||||
addFQ,
|
||||
addFakeQuantize,
|
||||
additionalLayer,
|
||||
{
|
||||
testValues.params.updatePrecisions ? testValues.params.precisionsOnActivations[0] : precision,
|
||||
testValues.subtractValues,
|
||||
testValues.mutliplyValues
|
||||
});
|
||||
testValues.actual.dequantization);
|
||||
|
||||
SimpleLowPrecisionTransformer transform;
|
||||
transform.add<ngraph::pass::low_precision::AvgPoolTransformation, ngraph::opset1::AvgPool>(testValues.params);
|
||||
@ -62,25 +72,31 @@ public:
|
||||
transform.transform(actualFunction);
|
||||
|
||||
referenceFunction = ngraph::builder::subgraph::AvgPoolFunction::getReference(
|
||||
precision,
|
||||
testValues.expected.inputPrecision,
|
||||
shape,
|
||||
addFQ,
|
||||
addFakeQuantize,
|
||||
additionalLayer,
|
||||
{
|
||||
testValues.params.updatePrecisions ? testValues.params.precisionsOnActivations[0] : precision,
|
||||
testValues.subtractValues,
|
||||
testValues.mutliplyValues
|
||||
});
|
||||
testValues.expected.dequantizationBefore,
|
||||
testValues.expected.preicsionAfterOperation,
|
||||
testValues.expected.dequantizationAfter);
|
||||
}
|
||||
|
||||
static std::string getTestCaseName(testing::TestParamInfo<AvgPoolTransformationParams> obj) {
|
||||
const ngraph::element::Type precision = std::get<0>(obj.param);
|
||||
const ngraph::Shape shape = std::get<1>(obj.param);
|
||||
const bool addFQ = std::get<2>(obj.param);
|
||||
const std::string additionalLayer = std::get<3>(obj.param);
|
||||
const AvgPoolTransformationTestValues testValues = std::get<4>(obj.param);
|
||||
return LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) +
|
||||
(addFQ ? "_FQ_after_" : "_") + (additionalLayer);
|
||||
const ngraph::Shape shape = std::get<0>(obj.param);
|
||||
const bool addFakeQuantize = std::get<1>(obj.param);
|
||||
const std::string additionalLayer = std::get<2>(obj.param);
|
||||
const AvgPoolTransformationTestValues testValues = std::get<3>(obj.param);
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<ngraph::element::Type> precisions = {
|
||||
ngraph::element::f32,
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<std::string> additionalLayer = {
|
||||
"",
|
||||
// issue #40768
|
||||
@ -110,20 +121,216 @@ const std::vector<bool> addFQ = {
|
||||
};
|
||||
|
||||
const std::vector<ngraph::Shape> shapes = {
|
||||
{ 1, 32, 72, 48 }
|
||||
{ 1, 3, 72, 48 }
|
||||
};
|
||||
|
||||
const std::vector<AvgPoolTransformationTestValues> testValues = {
|
||||
{ LayerTransformation::createParamsU8I8(), { 128 }, { 0.02f } },
|
||||
{ LayerTransformation::createParamsU8I8().setUpdatePrecisions(false), { 128 }, { 0.02f } },
|
||||
{ LayerTransformation::createParamsI8I8(), { 128 }, { 0.02f } },
|
||||
// U8 per tensor quantization
|
||||
{
|
||||
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(
|
||||
smoke_LPT,
|
||||
AvgPoolTransformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(precisions),
|
||||
::testing::ValuesIn(shapes),
|
||||
::testing::ValuesIn(addFQ),
|
||||
::testing::ValuesIn(additionalLayer),
|
||||
|
@ -42,12 +42,17 @@ class ResultValues {
|
||||
public:
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantization1;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantization2;
|
||||
ngraph::element::Type precisionBeforeOp;
|
||||
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) {
|
||||
return out << "_" << values.fakeQuantize1 << "_" << values.fakeQuantize2 << "_" << values.dequantization1 << "_" << values.dequantization2;
|
||||
return out << "_" << values.fakeQuantize1 << "_" << values.fakeQuantize2 << "_"
|
||||
<< values.dequantizationAfter1 << "_" << values.dequantizationAfter2;
|
||||
}
|
||||
|
||||
class TestValues {
|
||||
@ -65,7 +70,6 @@ inline std::ostream& operator<<(std::ostream& out, const TestValues& values) {
|
||||
|
||||
typedef std::tuple <
|
||||
ngraph::element::Type,
|
||||
bool,
|
||||
TestValues
|
||||
> ConcatTransformationParams;
|
||||
|
||||
@ -73,14 +77,7 @@ class ConcatSelectionWithIntermediateTransformation : public LayerTransformation
|
||||
public:
|
||||
void SetUp() override {
|
||||
const ngraph::element::Type precision = std::get<0>(GetParam());
|
||||
const bool updatePrecisions = 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;
|
||||
}
|
||||
TestValues testValues = std::get<1>(GetParam());
|
||||
|
||||
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalSelectionWithIntermediate(
|
||||
precision,
|
||||
@ -100,14 +97,17 @@ public:
|
||||
testValues.transparentIntermediate,
|
||||
testValues.result.fakeQuantize1,
|
||||
testValues.result.fakeQuantize2,
|
||||
testValues.result.dequantization1,
|
||||
testValues.result.dequantization2);
|
||||
testValues.result.precisionBeforeOp,
|
||||
testValues.result.dequantizationBefore1,
|
||||
testValues.result.dequantizationBefore2,
|
||||
testValues.result.precisionAfterOperation,
|
||||
testValues.result.dequantizationAfter1,
|
||||
testValues.result.dequantizationAfter2);
|
||||
}
|
||||
|
||||
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
|
||||
const ngraph::element::Type precision = std::get<0>(obj.param);
|
||||
const bool updatePrecision = std::get<1>(obj.param);
|
||||
const TestValues testValues = std::get<2>(obj.param);
|
||||
const TestValues testValues = std::get<1>(obj.param);
|
||||
|
||||
std::ostringstream result;
|
||||
result <<
|
||||
@ -120,8 +120,6 @@ public:
|
||||
};
|
||||
|
||||
TEST_P(ConcatSelectionWithIntermediateTransformation, CompareFunctions) {
|
||||
const TestValues testValues = std::get<2>(GetParam());
|
||||
|
||||
actualFunction->validate_nodes_and_infer_types();
|
||||
auto res = compare_functions(referenceFunction, actualFunction, true, true);
|
||||
ASSERT_TRUE(res.first) << res.second;
|
||||
@ -132,8 +130,6 @@ const std::vector<ngraph::element::Type> precisions = {
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<bool> updatePrecisions = { true, false };
|
||||
|
||||
const std::vector<TestValues> testValues = {
|
||||
// U8: Concat + MaxPool
|
||||
{
|
||||
@ -142,23 +138,46 @@ const std::vector<TestValues> testValues = {
|
||||
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}, {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 / 2.f}, {0.f}, { 128.f}, ngraph::element::u8 },
|
||||
{ ngraph::element::f32, {}, { 0.01f } },
|
||||
{ ngraph::element::f32, {}, { 0.01f } }
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {255.f} },
|
||||
ngraph::element::u8,
|
||||
{{}, {}, {}},
|
||||
{{}, {}, {}},
|
||||
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(
|
||||
// DISABLED_LPT,
|
||||
// ConcatSelectionWithIntermediateTransformation,
|
||||
// ::testing::Combine(
|
||||
// ::testing::ValuesIn(precisions),
|
||||
// ::testing::ValuesIn(updatePrecisions),
|
||||
// ::testing::ValuesIn(testValues)),
|
||||
// ConcatSelectionWithIntermediateTransformation::getTestCaseName);
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
smoke_LPT,
|
||||
ConcatSelectionWithIntermediateTransformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(precisions),
|
||||
::testing::ValuesIn(testValues)),
|
||||
ConcatSelectionWithIntermediateTransformation::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -41,11 +41,14 @@ class ConcatTransformationResultValues {
|
||||
public:
|
||||
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize1;
|
||||
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) {
|
||||
return out << "_" << values.fakeQuantize1 << "_" << values.fakeQuantize2 << "_" << values.dequantizationOperations;
|
||||
return out << "_" << values.fakeQuantize1 << "_" << values.fakeQuantize2 << "_" << values.dequantizationOperations2;
|
||||
}
|
||||
|
||||
class ConcatTransformationTestValues {
|
||||
@ -62,7 +65,6 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationTes
|
||||
|
||||
typedef std::tuple <
|
||||
ngraph::element::Type,
|
||||
bool,
|
||||
ngraph::Shape,
|
||||
ConcatTransformationTestValues
|
||||
> ConcatTransformationParams;
|
||||
@ -71,15 +73,8 @@ class ConcatTransformation : public LayerTransformation, public testing::WithPar
|
||||
public:
|
||||
void SetUp() override {
|
||||
const ngraph::element::Type precision = std::get<0>(GetParam());
|
||||
const bool updatePrecisions = std::get<1>(GetParam());
|
||||
const ngraph::Shape shape = 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;
|
||||
}
|
||||
const ngraph::Shape shape = std::get<1>(GetParam());
|
||||
ConcatTransformationTestValues testValues = std::get<2>(GetParam());
|
||||
|
||||
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginal(
|
||||
precision,
|
||||
@ -100,20 +95,21 @@ public:
|
||||
shape,
|
||||
testValues.result.fakeQuantize1,
|
||||
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) {
|
||||
const ngraph::element::Type precision = std::get<0>(obj.param);
|
||||
const bool updatePrecision = std::get<1>(obj.param);
|
||||
const ngraph::Shape shape = std::get<2>(obj.param);
|
||||
const ConcatTransformationTestValues testValues = std::get<3>(obj.param);
|
||||
const ngraph::Shape shape = std::get<1>(obj.param);
|
||||
const ConcatTransformationTestValues testValues = std::get<2>(obj.param);
|
||||
|
||||
std::ostringstream result;
|
||||
result <<
|
||||
LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_" <<
|
||||
(testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") <<
|
||||
(updatePrecision ? "updatePrecision_" : "notUpdatePrecision_") <<
|
||||
testValues.actual << "_" <<
|
||||
testValues.result << "_";
|
||||
return result.str();
|
||||
@ -131,8 +127,6 @@ const std::vector<ngraph::element::Type> precisions = {
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<bool> updatePrecisions = { true, false };
|
||||
|
||||
const std::vector<ConcatTransformationTestValues> testValues = {
|
||||
// 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}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ ngraph::element::f32, {}, { 0.01f } }
|
||||
{ 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 } },
|
||||
}
|
||||
},
|
||||
// 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}, {}, {}}, {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 },
|
||||
{ 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,
|
||||
{ {}, {}, {} },
|
||||
ngraph::element::u8,
|
||||
{ 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}, {}, {}}, {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 },
|
||||
{ 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,
|
||||
{ {}, {}, {} },
|
||||
ngraph::element::u8,
|
||||
{ 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}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, {}, {0.f}, {1.275f}, {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,
|
||||
{ {}, {}, {} },
|
||||
ngraph::element::u8,
|
||||
{ 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}, {}, {}}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, {{1}, {1}, {}, {}}, {0.f}, {1.275f}, {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,
|
||||
{ {}, {}, {} },
|
||||
ngraph::element::u8,
|
||||
{ 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},
|
||||
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 }} }
|
||||
}
|
||||
},
|
||||
@ -247,8 +259,11 @@ const std::vector<ConcatTransformationTestValues> testValues = {
|
||||
{ 256ul, {}, {1.275f}, {2.55f}, {1.275f}, {2.55f} }
|
||||
},
|
||||
{
|
||||
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, {}, {1.275f}, {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,
|
||||
{ {}, {}, {} },
|
||||
ngraph::element::u8,
|
||||
{
|
||||
ngraph::element::f32,
|
||||
{{ 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}, {-128.f}, {127.f}, ngraph::element::i8 },
|
||||
{ 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,
|
||||
{ {}, {}, {} },
|
||||
ngraph::element::i8,
|
||||
{ ngraph::element::f32, {}, { 0.01f } }
|
||||
}
|
||||
},
|
||||
@ -279,8 +297,11 @@ const std::vector<ConcatTransformationTestValues> testValues = {
|
||||
{ 256ul, {}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f} }
|
||||
},
|
||||
{
|
||||
{ 256ul, {}, {0.f}, {2.55f}, {85.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, {}, {-1.28f}, {1.27f}, {0.f}, {170.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,
|
||||
{ {}, {}, {} },
|
||||
ngraph::element::u8,
|
||||
{ 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, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, {}, {-1.28f}, {1.27f}, {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,
|
||||
{ {}, {}, {} },
|
||||
ngraph::element::u8,
|
||||
{ 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, {}, {-1.28f}, {1.27f}, {0.f}, {170.f}, ngraph::element::u8 },
|
||||
{ 256ul, {}, {0.f}, {2.55f}, {85.f}, {255.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,
|
||||
{ {}, {}, {} },
|
||||
ngraph::element::u8,
|
||||
{ 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, {}, {-1.28f}, {1.27f}, {128.f}, {204.f}, ngraph::element::u8 },
|
||||
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.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,
|
||||
{ {}, {}, {} },
|
||||
ngraph::element::u8,
|
||||
{ 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 = {
|
||||
@ -338,7 +385,6 @@ INSTANTIATE_TEST_CASE_P(
|
||||
ConcatTransformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(precisions),
|
||||
::testing::ValuesIn(updatePrecisions),
|
||||
::testing::ValuesIn(shapes),
|
||||
::testing::ValuesIn(testValues)),
|
||||
ConcatTransformation::getTestCaseName);
|
||||
|
@ -44,21 +44,23 @@ class ConcatTransformationResultValues {
|
||||
public:
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations1;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations2;
|
||||
ngraph::element::Type precisionBeforeOp;
|
||||
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) {
|
||||
return out << "_" <<
|
||||
values.fakeQuantize1 << "_" <<
|
||||
values.fakeQuantize2 << "_" <<
|
||||
values.dequantizationOperations1 << "_" <<
|
||||
values.dequantizationOperations2;
|
||||
values.dequantizationAfter1 << "_" <<
|
||||
values.dequantizationAfter2;
|
||||
}
|
||||
|
||||
class ConcatTransformationTestValues {
|
||||
public:
|
||||
ngraph::Shape inputShape;
|
||||
ngraph::pass::low_precision::LayerTransformation::Params params;
|
||||
bool multiChannels;
|
||||
ConcatTransformationActualValues actual;
|
||||
@ -71,7 +73,7 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationTes
|
||||
|
||||
typedef std::tuple <
|
||||
ngraph::element::Type,
|
||||
bool,
|
||||
ngraph::Shape,
|
||||
ConcatTransformationTestValues
|
||||
> ConcatTransformationParams;
|
||||
|
||||
@ -79,18 +81,12 @@ class ConcatWithDifferentChildsTransformation : public LayerTransformation, publ
|
||||
public:
|
||||
void SetUp() override {
|
||||
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());
|
||||
|
||||
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(
|
||||
precision,
|
||||
testValues.inputShape,
|
||||
inputShape,
|
||||
testValues.actual.fakeQuantize1,
|
||||
testValues.actual.fakeQuantize2);
|
||||
|
||||
@ -104,31 +100,28 @@ public:
|
||||
transform.add<ngraph::pass::low_precision::ClampTransformation, ngraph::opset1::Clamp>(testValues.params);
|
||||
transform.transform(actualFunction);
|
||||
|
||||
if (!updatePrecisions) {
|
||||
// there is no Convert operation after MaxPool in FP32
|
||||
testValues.result.dequantizationOperations2.convert = {};
|
||||
}
|
||||
|
||||
referenceFunction = ngraph::builder::subgraph::ConcatFunction::getReferenceWithDifferentPrecisionOnChilds(
|
||||
precision,
|
||||
testValues.inputShape,
|
||||
inputShape,
|
||||
testValues.multiChannels,
|
||||
testValues.result.fakeQuantize1,
|
||||
testValues.result.fakeQuantize2,
|
||||
testValues.result.dequantizationOperations1,
|
||||
testValues.result.dequantizationOperations2);
|
||||
testValues.result.precisionBeforeOp,
|
||||
testValues.result.dequantizationBefore,
|
||||
testValues.result.precisionAfterOperation,
|
||||
testValues.result.dequantizationAfter1,
|
||||
testValues.result.dequantizationAfter2);
|
||||
}
|
||||
|
||||
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
|
||||
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);
|
||||
|
||||
std::ostringstream result;
|
||||
result <<
|
||||
LayerTransformation::getTestCaseNameByParams(precision, testValues.inputShape, testValues.params) << "_" <<
|
||||
LayerTransformation::getTestCaseNameByParams(precision, inputShape, testValues.params) << "_" <<
|
||||
(testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") <<
|
||||
(updatePrecision ? "updatePrecision_" : "notUpdatePrecision_") <<
|
||||
testValues.actual << "_" <<
|
||||
testValues.result << "_";
|
||||
return result.str();
|
||||
@ -136,8 +129,6 @@ public:
|
||||
};
|
||||
|
||||
TEST_P(ConcatWithDifferentChildsTransformation, CompareFunctions) {
|
||||
const ConcatTransformationTestValues testValues = std::get<2>(GetParam());
|
||||
|
||||
actualFunction->validate_nodes_and_infer_types();
|
||||
auto res = compare_functions(referenceFunction, actualFunction, true, true, true);
|
||||
ASSERT_TRUE(res.first) << res.second;
|
||||
@ -148,12 +139,14 @@ const std::vector<ngraph::element::Type> precisions = {
|
||||
// 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 = {
|
||||
// U8
|
||||
{
|
||||
{ 1, 3, 10, 10 },
|
||||
LayerTransformation::createParamsU8I8(),
|
||||
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}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.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,
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{ ngraph::element::f32, {}, { 0.01f } },
|
||||
{ ngraph::element::f32, {}, { 0.01f } }
|
||||
}
|
||||
},
|
||||
// I8
|
||||
{
|
||||
{ 1, 3, 10, 10 },
|
||||
LayerTransformation::createParamsI8I8(),
|
||||
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}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 },
|
||||
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64.f}, { 64.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,
|
||||
{{}, {}, {}},
|
||||
ngraph::element::i8,
|
||||
{ ngraph::element::f32, {}, { 0.01f } },
|
||||
{ ngraph::element::f32, {}, { 0.01f } }
|
||||
}
|
||||
},
|
||||
// U8: concat multi channels
|
||||
{
|
||||
{ 1, 3, 10, 10 },
|
||||
LayerTransformation::createParamsU8I8(),
|
||||
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}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {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,
|
||||
{{}, {}, {}},
|
||||
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 }} },
|
||||
}
|
||||
},
|
||||
// I8: concat multi channels
|
||||
{
|
||||
{ 1, 3, 10, 10 },
|
||||
LayerTransformation::createParamsI8I8(),
|
||||
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}, {1.27f}, {-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 },
|
||||
{ 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,
|
||||
{{}, {}, {}},
|
||||
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 }} },
|
||||
}
|
||||
},
|
||||
// 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(
|
||||
@ -222,7 +242,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
ConcatWithDifferentChildsTransformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(precisions),
|
||||
::testing::ValuesIn(updatePrecisions),
|
||||
::testing::ValuesIn(shapes),
|
||||
::testing::ValuesIn(testValues)),
|
||||
ConcatWithDifferentChildsTransformation::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -42,16 +42,20 @@ class ConcatTransformationResultValues {
|
||||
public:
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations1;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations2;
|
||||
ngraph::element::Type precisionBeforeOp;
|
||||
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) {
|
||||
return out << "_" <<
|
||||
values.fakeQuantize1 << "_" <<
|
||||
values.fakeQuantize2 << "_" <<
|
||||
values.dequantizationOperations1 << "_" <<
|
||||
values.dequantizationOperations2;
|
||||
values.dequantizationAfter1 << "_" <<
|
||||
values.dequantizationAfter2;
|
||||
}
|
||||
|
||||
class ConcatTransformationTestValues {
|
||||
@ -69,7 +73,6 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationTes
|
||||
|
||||
typedef std::tuple <
|
||||
ngraph::element::Type,
|
||||
bool,
|
||||
ngraph::Shape,
|
||||
ConcatTransformationTestValues
|
||||
> ConcatTransformationParams;
|
||||
@ -78,15 +81,8 @@ class ConcatWithIntermediateTransformation : public LayerTransformation, public
|
||||
public:
|
||||
void SetUp() override {
|
||||
const ngraph::element::Type precision = std::get<0>(GetParam());
|
||||
const bool updatePrecisions = std::get<1>(GetParam());
|
||||
const ngraph::Shape shape = 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;
|
||||
}
|
||||
const ngraph::Shape shape = std::get<1>(GetParam());
|
||||
ConcatTransformationTestValues testValues = std::get<2>(GetParam());
|
||||
|
||||
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithIntermediate(
|
||||
precision,
|
||||
@ -110,21 +106,23 @@ public:
|
||||
testValues.transparentIntermediate,
|
||||
testValues.result.fakeQuantize1,
|
||||
testValues.result.fakeQuantize2,
|
||||
testValues.result.dequantizationOperations1,
|
||||
testValues.result.dequantizationOperations2);
|
||||
testValues.result.precisionBeforeOp,
|
||||
testValues.result.dequantizationBefore1,
|
||||
testValues.result.dequantizationBefore2,
|
||||
testValues.result.precisionAfterOperation,
|
||||
testValues.result.dequantizationAfter1,
|
||||
testValues.result.dequantizationAfter2);
|
||||
}
|
||||
|
||||
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
|
||||
const ngraph::element::Type precision = std::get<0>(obj.param);
|
||||
const bool updatePrecision = std::get<1>(obj.param);
|
||||
const ngraph::Shape shape = std::get<2>(obj.param);
|
||||
const ConcatTransformationTestValues testValues = std::get<3>(obj.param);
|
||||
const ngraph::Shape shape = std::get<1>(obj.param);
|
||||
const ConcatTransformationTestValues testValues = std::get<2>(obj.param);
|
||||
|
||||
std::ostringstream result;
|
||||
result <<
|
||||
LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_" <<
|
||||
(testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") <<
|
||||
(updatePrecision ? "updatePrecision_" : "notUpdatePrecision_") <<
|
||||
testValues.actual << "_" <<
|
||||
testValues.result << "_";
|
||||
return result.str();
|
||||
@ -142,8 +140,6 @@ const std::vector<ngraph::element::Type> precisions = {
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<bool> updatePrecisions = { true, false };
|
||||
|
||||
const std::vector<ConcatTransformationTestValues> testValues = {
|
||||
// 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}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.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,
|
||||
{{}, {}, {}},
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{ 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}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 },
|
||||
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64.f}, { 64.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,
|
||||
{{}, {}, {}},
|
||||
{{}, {}, {}},
|
||||
ngraph::element::i8,
|
||||
{ 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({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {128.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,
|
||||
{{}, {}, {}},
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{ 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}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {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,
|
||||
{{}, {}, {}},
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 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}, {1.27f}, {-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 },
|
||||
{ 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,
|
||||
{{}, {}, {}},
|
||||
{{}, {}, {}},
|
||||
ngraph::element::i8,
|
||||
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 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({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, ngraph::Shape({}), {1.275f}, {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,
|
||||
{{}, {}, {}},
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{
|
||||
ngraph::element::f32,
|
||||
{{ 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 } }
|
||||
}
|
||||
},
|
||||
// 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 = {
|
||||
@ -257,7 +297,6 @@ INSTANTIATE_TEST_CASE_P(
|
||||
ConcatWithIntermediateTransformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(precisions),
|
||||
::testing::ValuesIn(updatePrecisions),
|
||||
::testing::ValuesIn(shapes),
|
||||
::testing::ValuesIn(testValues)),
|
||||
ConcatWithIntermediateTransformation::getTestCaseName);
|
||||
|
@ -215,7 +215,7 @@ const std::vector<ConcatTransformationTestValues> testValues = {
|
||||
{ {}, {}, {} },
|
||||
ngraph::element::f32,
|
||||
ngraph::element::f32,
|
||||
{ ngraph::element::f32, {}, { 0.01f } },
|
||||
{ {}, {}, { 0.01f } },
|
||||
ngraph::element::f32
|
||||
}
|
||||
},
|
||||
@ -296,7 +296,7 @@ const std::vector<ConcatTransformationTestValues> testValues = {
|
||||
ngraph::element::f32,
|
||||
ngraph::element::f32,
|
||||
{
|
||||
ngraph::element::f32,
|
||||
{},
|
||||
{{ -255.f, -255.f, -255.f, 0.f, 0.f, 0.f }},
|
||||
{{ 0.005f, 0.005f, 0.005f, 0.01f, 0.01f, 0.01f }}
|
||||
},
|
||||
|
@ -43,8 +43,11 @@ public:
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize2;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize3;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations1;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations2;
|
||||
ngraph::element::Type precisionBeforeOp;
|
||||
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) {
|
||||
@ -52,8 +55,8 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationRes
|
||||
values.fakeQuantize1 << "_" <<
|
||||
values.fakeQuantize2 << "_" <<
|
||||
values.fakeQuantize3 << "_" <<
|
||||
values.dequantizationOperations1 << "_" <<
|
||||
values.dequantizationOperations2;
|
||||
values.dequantizationAfter1 << "_" <<
|
||||
values.dequantizationAfter2;
|
||||
}
|
||||
|
||||
class ConcatTransformationTestValues {
|
||||
@ -70,7 +73,6 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationTes
|
||||
|
||||
typedef std::tuple <
|
||||
ngraph::element::Type,
|
||||
bool,
|
||||
ngraph::Shape,
|
||||
ConcatTransformationTestValues
|
||||
> ConcatTransformationParams;
|
||||
@ -79,16 +81,8 @@ class ConcatWithNeighborsTransformation : public LayerTransformation, public tes
|
||||
public:
|
||||
void SetUp() override {
|
||||
const ngraph::element::Type precision = std::get<0>(GetParam());
|
||||
const bool updatePrecisions = std::get<1>(GetParam());
|
||||
const ngraph::Shape shape = 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;
|
||||
}
|
||||
const ngraph::Shape shape = std::get<1>(GetParam());
|
||||
ConcatTransformationTestValues testValues = std::get<2>(GetParam());
|
||||
|
||||
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithNeighbors(
|
||||
precision,
|
||||
@ -111,21 +105,22 @@ public:
|
||||
testValues.result.fakeQuantize1,
|
||||
testValues.result.fakeQuantize2,
|
||||
testValues.result.fakeQuantize3,
|
||||
testValues.result.dequantizationOperations1,
|
||||
testValues.result.dequantizationOperations2);
|
||||
testValues.result.precisionBeforeOp,
|
||||
testValues.result.dequantizationBefore,
|
||||
testValues.result.precisionAfterOp,
|
||||
testValues.result.dequantizationAfter1,
|
||||
testValues.result.dequantizationAfter2);
|
||||
}
|
||||
|
||||
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
|
||||
const ngraph::element::Type precision = std::get<0>(obj.param);
|
||||
const bool updatePrecision = std::get<1>(obj.param);
|
||||
const ngraph::Shape shape = std::get<2>(obj.param);
|
||||
const ConcatTransformationTestValues testValues = std::get<3>(obj.param);
|
||||
const ngraph::Shape shape = std::get<1>(obj.param);
|
||||
const ConcatTransformationTestValues testValues = std::get<2>(obj.param);
|
||||
|
||||
std::ostringstream result;
|
||||
result <<
|
||||
LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_" <<
|
||||
(testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") <<
|
||||
(updatePrecision ? "updatePrecision_" : "notUpdatePrecision_") <<
|
||||
testValues.actual << "_" <<
|
||||
testValues.result << "_";
|
||||
return result.str();
|
||||
@ -143,8 +138,6 @@ const std::vector<ngraph::element::Type> precisions = {
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<bool> updatePrecisions = { true, false };
|
||||
|
||||
const std::vector<ConcatTransformationTestValues> testValues = {
|
||||
// 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}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {128.f}, ngraph::element::u8 },
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {85.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} },
|
||||
{ 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 } }
|
||||
}
|
||||
@ -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}, {255.f}, ngraph::element::u8 },
|
||||
{ 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 },
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
|
||||
{ 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,
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{ 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 }} }
|
||||
}
|
||||
@ -190,9 +189,12 @@ const std::vector<ConcatTransformationTestValues> testValues = {
|
||||
{ 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({}), {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 },
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f}, {0.f}, {255.f} },
|
||||
{ 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,
|
||||
{{}, {}, {}},
|
||||
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, { -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}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 },
|
||||
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64}, {64.f}, ngraph::element::i8 },
|
||||
{ 256ul, ngraph::Shape({}), {-1.28f / 3.f}, {1.27f / 3.f}, {-43}, {42.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} },
|
||||
{ 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 } }
|
||||
}
|
||||
@ -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}, {1.27f}, {-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 },
|
||||
{ 256ul, ngraph::Shape({}), {-1.28f / 3.f}, {1.27f / 3.f}, {-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} },
|
||||
{ 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.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({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 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 },
|
||||
{ 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::u8,
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{ ngraph::element::f32, {{ 0.f, 0.f, 0.f, 128.f, 128.f, 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 = {
|
||||
@ -260,7 +291,6 @@ INSTANTIATE_TEST_CASE_P(
|
||||
ConcatWithNeighborsTransformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(precisions),
|
||||
::testing::ValuesIn(updatePrecisions),
|
||||
::testing::ValuesIn(shapes),
|
||||
::testing::ValuesIn(testValues)),
|
||||
ConcatWithNeighborsTransformation::getTestCaseName);
|
||||
|
@ -45,6 +45,8 @@ public:
|
||||
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize1;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize2;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize3;
|
||||
ngraph::element::Type precisionBeforeOp;
|
||||
ngraph::element::Type precisionAfterOp;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOperations;
|
||||
};
|
||||
|
||||
@ -65,7 +67,6 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationTes
|
||||
|
||||
typedef std::tuple <
|
||||
ngraph::element::Type,
|
||||
bool,
|
||||
ngraph::Shape,
|
||||
ConcatTransformationTestValues
|
||||
> ConcatTransformationParams;
|
||||
@ -74,16 +75,8 @@ class ConcatWithReshapeAtTheEndTransformation : public LayerTransformation, publ
|
||||
public:
|
||||
void SetUp() override {
|
||||
const ngraph::element::Type precision = std::get<0>(GetParam());
|
||||
const bool updatePrecisions = std::get<1>(GetParam());
|
||||
const ngraph::Shape shape = 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;
|
||||
}
|
||||
const ngraph::Shape shape = std::get<1>(GetParam());
|
||||
ConcatTransformationTestValues testValues = std::get<2>(GetParam());
|
||||
|
||||
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithReshapeAtTheEndTransformation(
|
||||
precision,
|
||||
@ -98,30 +91,25 @@ public:
|
||||
transform.add<ngraph::pass::low_precision::ReshapeTransformation, ngraph::opset1::Reshape>(testValues.params);
|
||||
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(
|
||||
precision,
|
||||
shape,
|
||||
testValues.result.fakeQuantize1,
|
||||
testValues.result.fakeQuantize2,
|
||||
testValues.result.fakeQuantize3,
|
||||
testValues.result.precisionBeforeOp,
|
||||
testValues.result.precisionAfterOp,
|
||||
testValues.result.dequantizationOperations);
|
||||
}
|
||||
|
||||
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
|
||||
const ngraph::element::Type precision = std::get<0>(obj.param);
|
||||
const bool updatePrecision = std::get<1>(obj.param);
|
||||
const ngraph::Shape shape = std::get<2>(obj.param);
|
||||
const ConcatTransformationTestValues testValues = std::get<3>(obj.param);
|
||||
const ngraph::Shape shape = std::get<1>(obj.param);
|
||||
const ConcatTransformationTestValues testValues = std::get<2>(obj.param);
|
||||
|
||||
std::ostringstream result;
|
||||
result <<
|
||||
LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_" <<
|
||||
(updatePrecision ? "updatePrecision_" : "notUpdatePrecision_") <<
|
||||
testValues.actual << "_" <<
|
||||
testValues.result << "_";
|
||||
return result.str();
|
||||
@ -138,8 +126,6 @@ const std::vector<ngraph::element::Type> precisions = {
|
||||
ngraph::element::f32,
|
||||
};
|
||||
|
||||
const std::vector<bool> updatePrecisions = { true, false };
|
||||
|
||||
const std::vector<ConcatTransformationTestValues> testValues = {
|
||||
{
|
||||
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}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 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} },
|
||||
{ 256ul, {}, {0.f}, {2.55f}, {0.f}, {255.f} },
|
||||
ngraph::element::u8,
|
||||
ngraph::element::u8,
|
||||
{ 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(),
|
||||
{
|
||||
@ -178,20 +182,20 @@ const std::vector<ConcatTransformationTestValues> testValues = {
|
||||
{
|
||||
256ul,
|
||||
{{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,
|
||||
{{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,
|
||||
{{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}
|
||||
},
|
||||
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 }} }
|
||||
}
|
||||
}
|
||||
@ -207,7 +211,6 @@ INSTANTIATE_TEST_CASE_P(
|
||||
ConcatWithReshapeAtTheEndTransformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(precisions),
|
||||
::testing::ValuesIn(updatePrecisions),
|
||||
::testing::ValuesIn(shapes),
|
||||
::testing::ValuesIn(testValues)),
|
||||
ConcatWithReshapeAtTheEndTransformation::getTestCaseName);
|
||||
|
@ -43,6 +43,10 @@ class ConcatTransformationResultValues {
|
||||
public:
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize1;
|
||||
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 dequantizationOperations2;
|
||||
};
|
||||
@ -70,7 +74,6 @@ inline std::ostream& operator<<(std::ostream& out, const ConcatTransformationTes
|
||||
|
||||
typedef std::tuple <
|
||||
ngraph::element::Type,
|
||||
bool,
|
||||
ConcatTransformationTestValues
|
||||
> ConcatTransformationParams;
|
||||
|
||||
@ -78,14 +81,7 @@ class ConcatWithSplitTransformation : public LayerTransformation, public testing
|
||||
public:
|
||||
void SetUp() override {
|
||||
const ngraph::element::Type precision = std::get<0>(GetParam());
|
||||
const bool updatePrecisions = 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;
|
||||
}
|
||||
ConcatTransformationTestValues testValues = std::get<1>(GetParam());
|
||||
|
||||
actualFunction = ngraph::builder::subgraph::ConcatFunction::getOriginalWithSplitedIntermediate(
|
||||
precision,
|
||||
@ -107,20 +103,22 @@ public:
|
||||
testValues.inputShape,
|
||||
testValues.result.fakeQuantize1,
|
||||
testValues.result.fakeQuantize2,
|
||||
testValues.result.precisionBeforeOp,
|
||||
testValues.result.dequantizationBefore1,
|
||||
testValues.result.dequantizationBefore2,
|
||||
testValues.result.precisionAfterOperation,
|
||||
testValues.result.dequantizationOperations1,
|
||||
testValues.result.dequantizationOperations2);
|
||||
}
|
||||
|
||||
static std::string getTestCaseName(testing::TestParamInfo<ConcatTransformationParams> obj) {
|
||||
const ngraph::element::Type precision = std::get<0>(obj.param);
|
||||
const bool updatePrecision = std::get<1>(obj.param);
|
||||
const ConcatTransformationTestValues testValues = std::get<2>(obj.param);
|
||||
const ConcatTransformationTestValues testValues = std::get<1>(obj.param);
|
||||
|
||||
std::ostringstream result;
|
||||
result <<
|
||||
LayerTransformation::getTestCaseNameByParams(precision, testValues.inputShape, testValues.params) << "_" <<
|
||||
(testValues.multiChannels ? "multiChannels_" : "notMultiChannels_") <<
|
||||
(updatePrecision ? "updatePrecision_" : "notUpdatePrecision_") <<
|
||||
testValues.actual << "_" <<
|
||||
testValues.result << "_";
|
||||
return result.str();
|
||||
@ -128,8 +126,6 @@ public:
|
||||
};
|
||||
|
||||
TEST_P(ConcatWithSplitTransformation, CompareFunctions) {
|
||||
const ConcatTransformationTestValues testValues = std::get<2>(GetParam());
|
||||
|
||||
actualFunction->validate_nodes_and_infer_types();
|
||||
auto res = compare_functions(referenceFunction, actualFunction, true);
|
||||
ASSERT_TRUE(res.first) << res.second;
|
||||
@ -140,8 +136,6 @@ const std::vector<ngraph::element::Type> precisions = {
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<bool> updatePrecisions = { true, false };
|
||||
|
||||
const std::vector<ConcatTransformationTestValues> testValues = {
|
||||
// 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}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {0.f}, { 128.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,
|
||||
{{}, {}, {}},
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{ 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}, {1.27f}, {-128.f}, {127.f}, ngraph::element::i8 },
|
||||
{ 256ul, ngraph::Shape({}), {-1.28f / 2.f}, {1.27f / 2.f}, {-64.f}, { 64.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,
|
||||
{{}, {}, {}},
|
||||
{{}, {}, {}},
|
||||
ngraph::element::i8,
|
||||
{ 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({}), {0.f}, {2.55f}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, ngraph::Shape({}), {1.275f}, {2.55f}, {128.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,
|
||||
{{}, {}, {}},
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{ 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}, {0.f}, {255.f}, ngraph::element::u8 },
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {2.55f / 2.f}, {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,
|
||||
{{}, {}, {}},
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 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}, {1.27f}, {-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 },
|
||||
{ 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,
|
||||
{{}, {}, {}},
|
||||
{{}, {}, {}},
|
||||
ngraph::element::i8,
|
||||
{ ngraph::element::f32, {}, {{ 0.01f, 0.01f, 0.01f, 0.005f, 0.005f, 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
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
DISABLED_LPT,
|
||||
DISABLED_smoke_LPT,
|
||||
ConcatWithSplitTransformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(precisions),
|
||||
::testing::ValuesIn(updatePrecisions),
|
||||
::testing::ValuesIn(testValues)),
|
||||
ConcatWithSplitTransformation::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
public:
|
||||
ngraph::element::Type precisionBeforeDequantization;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationBefore;
|
||||
ngraph::element::Type precisionAfterOperation;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter;
|
||||
};
|
||||
|
||||
@ -68,6 +69,7 @@ public:
|
||||
testValues.blockSize,
|
||||
testValues.expected.precisionBeforeDequantization,
|
||||
testValues.expected.dequantizationBefore,
|
||||
testValues.expected.precisionAfterOperation,
|
||||
testValues.expected.dequantizationAfter);
|
||||
}
|
||||
|
||||
@ -110,6 +112,7 @@ const std::vector<DepthToSpaceTransformationTestValues> testValues = {
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{{ngraph::element::f32}, {0.32f}, {0.45f}}
|
||||
}
|
||||
},
|
||||
@ -126,6 +129,7 @@ const std::vector<DepthToSpaceTransformationTestValues> testValues = {
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{{ngraph::element::f32}, {0.32f}, {0.45f}}
|
||||
}
|
||||
},
|
||||
@ -142,10 +146,11 @@ const std::vector<DepthToSpaceTransformationTestValues> testValues = {
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{{}, {}, {}},
|
||||
ngraph::element::u8,
|
||||
{{ngraph::element::f32}, {0.32f}, {0.45f}}
|
||||
}
|
||||
},
|
||||
// not scalar-like dequantizations
|
||||
// not scalar-like dequantizations with different values
|
||||
{
|
||||
ngraph::Shape{ 1, 4, 3, 3 },
|
||||
DepthToSpace::DepthToSpaceMode::BLOCKS_FIRST,
|
||||
@ -166,9 +171,56 @@ const std::vector<DepthToSpaceTransformationTestValues> testValues = {
|
||||
{{0.32f, 0.5f, 0.6f, 0.77f}},
|
||||
{{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);
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#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/dequantization_operations.hpp"
|
||||
#include "lpt_ngraph_functions/fake_quantize_and_two_output_branches_with_convolution_function.hpp"
|
||||
|
||||
#include "simple_low_precision_transformer.hpp"
|
||||
@ -28,35 +29,33 @@ using namespace ngraph::pass;
|
||||
|
||||
class FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues {
|
||||
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;
|
||||
ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::ActualValues actual;
|
||||
ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::ExpectedValues expected;
|
||||
ActualValues actual;
|
||||
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<
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
bool,
|
||||
FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues> FakeQuantizeAndTwoOutputBranchesWithConvolutionParams;
|
||||
|
||||
class FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation :
|
||||
@ -66,39 +65,41 @@ public:
|
||||
void SetUp() override {
|
||||
const ngraph::element::Type precision = std::get<0>(GetParam());
|
||||
const ngraph::Shape shape = std::get<1>(GetParam());
|
||||
const bool updatePrecision = 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);
|
||||
const FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues testValues = std::get<2>(GetParam());
|
||||
|
||||
actualFunction = ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::getOriginal(
|
||||
precision,
|
||||
shape,
|
||||
testValues.actual);
|
||||
testValues.actual.fqOnData,
|
||||
testValues.actual.fqOnWeights1,
|
||||
testValues.actual.fqOnWeights2);
|
||||
|
||||
SimpleLowPrecisionTransformer transform;
|
||||
transform.add<ngraph::pass::low_precision::FakeQuantizeTransformation, ngraph::opset1::FakeQuantize>(params);
|
||||
transform.add<ngraph::pass::low_precision::ConvolutionTransformation, ngraph::opset1::Convolution>(params);
|
||||
transform.add<ngraph::pass::low_precision::FakeQuantizeTransformation, ngraph::opset1::FakeQuantize>(testValues.params);
|
||||
transform.add<ngraph::pass::low_precision::ConvolutionTransformation, ngraph::opset1::Convolution>(testValues.params);
|
||||
transform.transform(actualFunction);
|
||||
|
||||
referenceFunction = ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::getReference(
|
||||
precision,
|
||||
shape,
|
||||
params,
|
||||
testValues.expected);
|
||||
testValues.params,
|
||||
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) {
|
||||
const ngraph::element::Type precision = std::get<0>(obj.param);
|
||||
const ngraph::Shape shape = std::get<1>(obj.param);
|
||||
const bool updatePrecision = std::get<2>(obj.param);
|
||||
const FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues testValues = std::get<3>(obj.param);
|
||||
const FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues testValues = std::get<2>(obj.param);
|
||||
|
||||
std::ostringstream result;
|
||||
result << LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) <<
|
||||
(updatePrecision ? "" : "_notUpdatePrecision_") <<
|
||||
testValues;
|
||||
result << LayerTransformation::getTestCaseNameByParams(precision, shape, testValues.params) << "_"
|
||||
<< testValues.expected.fqOnData << "_" << testValues.expected.dequantizationAfter1 << "_"
|
||||
<< testValues.expected.dequantizationAfter2;
|
||||
return result.str();
|
||||
}
|
||||
};
|
||||
@ -114,11 +115,6 @@ const std::vector<ngraph::element::Type> precisions = {
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<bool> updatePrecisions = {
|
||||
true,
|
||||
false
|
||||
};
|
||||
|
||||
const std::vector<FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues> fakeQuantizeOnDataTestValues = {
|
||||
// U8
|
||||
{
|
||||
@ -130,10 +126,32 @@ const std::vector<FakeQuantizeAndTwoOutputBranchesWithConvolutionTestValues> fak
|
||||
},
|
||||
{
|
||||
{ 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 } },
|
||||
{ 1.f },
|
||||
{{}, {}, {{ 1.f }, ngraph::element::f32, { 1, 1, 1 }}},
|
||||
{ 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::ValuesIn(precisions),
|
||||
::testing::ValuesIn(shapes),
|
||||
::testing::ValuesIn(updatePrecisions),
|
||||
::testing::ValuesIn(fakeQuantizeOnDataTestValues)),
|
||||
FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation::getTestCaseName);
|
||||
|
@ -15,26 +15,23 @@
|
||||
#include <low_precision/fake_quantize.hpp>
|
||||
|
||||
#include "common_test_utils/ngraph_test_utils.hpp"
|
||||
|
||||
#include "lpt_ngraph_functions/fake_quantize_function.hpp"
|
||||
#include "lpt_ngraph_functions/common/dequantization_operations.hpp"
|
||||
|
||||
#include "simple_low_precision_transformer.hpp"
|
||||
|
||||
using namespace testing;
|
||||
using namespace ngraph;
|
||||
using namespace ngraph::pass;
|
||||
|
||||
class ExpectedValues {
|
||||
public:
|
||||
std::vector<float> subtract;
|
||||
std::vector<float> multiply;
|
||||
};
|
||||
|
||||
class FakeQuantizeTransformationTestValues {
|
||||
public:
|
||||
low_precision::LayerTransformation::Params params;
|
||||
builder::subgraph::FakeQuantizeOnData actual;
|
||||
builder::subgraph::FakeQuantizeOnData expected;
|
||||
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) {
|
||||
@ -87,8 +84,7 @@ public:
|
||||
params.updatePrecisions,
|
||||
fakeQuantizeOnData.expected,
|
||||
fakeQuantizeOnData.expectedFakeQuantizeOnDataPrecision,
|
||||
fakeQuantizeOnData.expectedValues.find(element::f32)->second.subtract,
|
||||
fakeQuantizeOnData.expectedValues.find(element::f32)->second.multiply);
|
||||
fakeQuantizeOnData.expectedValues.find(element::f32)->second);
|
||||
}
|
||||
|
||||
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 } },
|
||||
ngraph::element::u8,
|
||||
{
|
||||
{ ngraph::element::f32, { {}, { 0.01f }} },
|
||||
{ ngraph::element::f16, { {}, { 0.01f }} }
|
||||
{ ngraph::element::f32, { {ngraph::element::f32}, {}, { 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 } },
|
||||
ngraph::element::u8,
|
||||
{
|
||||
{ ngraph::element::f32, {{ 82.97619048f }, { 0.014823529f }} },
|
||||
{ ngraph::element::f16, {{ 83.f }, { 0.014823529f }} }
|
||||
{ ngraph::element::f32, {{ngraph::element::f32}, { 82.97619048f }, { 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 } },
|
||||
ngraph::element::u8,
|
||||
{
|
||||
{ ngraph::element::f32, {{ 128.f }, { 0.01f }} },
|
||||
{ ngraph::element::f16, {{ 128.f }, { 0.01f }} }
|
||||
{ ngraph::element::f32, {{ngraph::element::f32}, { 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 } },
|
||||
ngraph::element::i8,
|
||||
{
|
||||
{ ngraph::element::f32, {{ }, { 0.01f }} },
|
||||
{ ngraph::element::f16, {{ }, { 0.01f }} }
|
||||
{ ngraph::element::f32, {{ngraph::element::f32}, { }, { 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 } },
|
||||
ngraph::element::i8,
|
||||
{
|
||||
{ ngraph::element::f32, {{ -105.9856115f }, { 0.00545098f }} },
|
||||
{ ngraph::element::f16, {{ -105.9856115f }, { 0.00545098f }} }
|
||||
{ ngraph::element::f32, {{ngraph::element::f32}, { -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 } },
|
||||
ngraph::element::i8,
|
||||
{
|
||||
{ ngraph::element::f32, {{ -128.f }, { 0.01f }} },
|
||||
{ ngraph::element::f16, {{ -128.f }, { 0.01f }} }
|
||||
{ ngraph::element::f32, {{ngraph::element::f32}, { -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 } },
|
||||
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 } },
|
||||
ngraph::element::i8,
|
||||
{
|
||||
{ ngraph::element::f32, {{ }, { -0.504395f / -128.0f }} },
|
||||
{ ngraph::element::f16, {{ }, { -0.504395f / -128.0f }} }
|
||||
{ ngraph::element::f32, {{ngraph::element::f32}, { }, { -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 } },
|
||||
ngraph::element::u8,
|
||||
{
|
||||
{ ngraph::element::f32, {{ }, { 1e-32f }} },
|
||||
{ ngraph::element::f16, {{ }, { 1e-32f }} }
|
||||
{ ngraph::element::f32, {{ngraph::element::f32}, { }, { 1e-32f }} },
|
||||
{ ngraph::element::f16, {{ngraph::element::f16}, { }, { 1e-32f }} }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -5,48 +5,65 @@
|
||||
#include <gtest/gtest.h>
|
||||
#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 ngraph::pass::low_precision;
|
||||
|
||||
class LowPrecisionTransformationsTests : public Test {};
|
||||
|
||||
TEST_F(LowPrecisionTransformationsTests, remove) {
|
||||
TEST_F(LowPrecisionTransformationsTests, removeAll) {
|
||||
LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params());
|
||||
auto transformation = transformations.find("Convolution");
|
||||
ASSERT_NE(0, transformation.size());
|
||||
|
||||
transformations.remove("Convolution");
|
||||
transformations.removeAll<ngraph::pass::low_precision::ConvolutionTransformation, ngraph::opset1::Convolution>();
|
||||
transformation = transformations.find("Convolution");
|
||||
ASSERT_EQ(0, transformation.size());
|
||||
}
|
||||
|
||||
TEST_F(LowPrecisionTransformationsTests, removeBranchSpecificTransformations) {
|
||||
TEST_F(LowPrecisionTransformationsTests, removeBranchSpecific) {
|
||||
LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params());
|
||||
auto transformation = transformations.find("Concat");
|
||||
ASSERT_NE(0, transformation.size());
|
||||
|
||||
transformations.removeBranchSpecificTransformations("Concat");
|
||||
transformations.removeBranchSpecific<ngraph::pass::low_precision::ConcatMultiChannelsTransformation, ngraph::opset1::Concat>();
|
||||
transformation = transformations.find("Concat");
|
||||
ASSERT_EQ(0, transformation.size());
|
||||
}
|
||||
|
||||
TEST_F(LowPrecisionTransformationsTests, removeTransformations) {
|
||||
TEST_F(LowPrecisionTransformationsTests, remove) {
|
||||
LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params());
|
||||
auto transformation = transformations.find("MatMul");
|
||||
ASSERT_NE(0, transformation.size());
|
||||
|
||||
transformations.removeTransformations("MatMul");
|
||||
transformations.remove<ngraph::pass::low_precision::MatMulTransformation, ngraph::opset1::MatMul>();
|
||||
transformation = transformations.find("MatMul");
|
||||
ASSERT_EQ(0, transformation.size());
|
||||
}
|
||||
|
||||
TEST_F(LowPrecisionTransformationsTests, removeCleanupTransformations) {
|
||||
TEST_F(LowPrecisionTransformationsTests, removeCleanup) {
|
||||
LowPrecisionTransformations transformations = LowPrecisionTransformer::getAllTransformations(LayerTransformation::Params());
|
||||
auto transformation = transformations.find("Multiply");
|
||||
ASSERT_NE(0, 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");
|
||||
ASSERT_EQ(originalSize - 1, transformation.size());
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
public:
|
||||
ngraph::element::Type precisionBeforeDequantization;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantization1;
|
||||
ngraph::element::Type preicsionAfterOperation;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantization2;
|
||||
};
|
||||
|
||||
@ -36,6 +37,7 @@ public:
|
||||
public:
|
||||
ngraph::element::Type precisionBeforeDequantization;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantization1;
|
||||
ngraph::element::Type preicsionAfterOperation;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantization2;
|
||||
};
|
||||
|
||||
@ -58,6 +60,7 @@ public:
|
||||
shape,
|
||||
testValues.actual.precisionBeforeDequantization,
|
||||
testValues.actual.dequantization1,
|
||||
testValues.actual.preicsionAfterOperation,
|
||||
testValues.actual.dequantization2);
|
||||
|
||||
SimpleLowPrecisionTransformer transform;
|
||||
@ -68,6 +71,7 @@ public:
|
||||
shape,
|
||||
testValues.expected.precisionBeforeDequantization,
|
||||
testValues.expected.dequantization1,
|
||||
testValues.expected.preicsionAfterOperation,
|
||||
testValues.expected.dequantization2);
|
||||
}
|
||||
|
||||
@ -104,11 +108,13 @@ const std::vector<MaxPoolTransformationTestValues> testValues = {
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{ {}, {}, { {0.02f}, ngraph::element::f32, {}, true, 1, ngraph::element::f32 }},
|
||||
ngraph::element::f32,
|
||||
{}
|
||||
},
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{},
|
||||
ngraph::element::u8,
|
||||
{ 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 },
|
||||
{ {0.02f}, ngraph::element::f32, {}, true, 1, ngraph::element::f32 }
|
||||
},
|
||||
ngraph::element::f32,
|
||||
{}
|
||||
},
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{},
|
||||
ngraph::element::u8,
|
||||
{
|
||||
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::f32, { 128 }, { 0.02f }},
|
||||
ngraph::element::f32,
|
||||
{}
|
||||
},
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{},
|
||||
ngraph::element::u8,
|
||||
{ ngraph::element::f32, { 128 }, { 0.02f }}
|
||||
}
|
||||
},
|
||||
@ -154,11 +164,13 @@ const std::vector<MaxPoolTransformationTestValues> testValues = {
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{ ngraph::element::f32, {}, { 0.02f }},
|
||||
ngraph::element::f32,
|
||||
{}
|
||||
},
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{},
|
||||
ngraph::element::u8,
|
||||
{ ngraph::element::f32, {}, { 0.02f }}
|
||||
}
|
||||
},
|
||||
@ -166,28 +178,32 @@ const std::vector<MaxPoolTransformationTestValues> testValues = {
|
||||
{
|
||||
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
|
||||
{
|
||||
ngraph::element::u8,
|
||||
ngraph::element::f32,
|
||||
{ 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
|
||||
{
|
||||
LayerTransformation::createParamsU8I8().setUpdatePrecisions(false),
|
||||
{
|
||||
ngraph::element::u8,
|
||||
ngraph::element::f32,
|
||||
{ ngraph::element::f32, {}, { 0.02f }},
|
||||
ngraph::element::f32,
|
||||
{}
|
||||
},
|
||||
{
|
||||
ngraph::element::u8,
|
||||
ngraph::element::f32,
|
||||
{},
|
||||
{ ngraph::element::f32, {}, { 0.02f }}
|
||||
ngraph::element::f32,
|
||||
{ {}, {}, { 0.02f }}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -15,7 +15,9 @@
|
||||
#include <low_precision/normalize_l2.hpp>
|
||||
|
||||
#include "common_test_utils/ngraph_test_utils.hpp"
|
||||
|
||||
#include "lpt_ngraph_functions/normalize_l2_function.hpp"
|
||||
#include "lpt_ngraph_functions/common/dequantization_operations.hpp"
|
||||
|
||||
using namespace testing;
|
||||
using namespace ngraph::pass;
|
||||
@ -23,60 +25,72 @@ using namespace ngraph::builder::subgraph;
|
||||
|
||||
class NormalizeL2TransformationTestValues {
|
||||
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;
|
||||
|
||||
NormalizeL2ActualValues actual;
|
||||
NormalizeL2ExpectedValues expected;
|
||||
Actual actual;
|
||||
Expected expected;
|
||||
};
|
||||
|
||||
typedef std::tuple<
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
ngraph::op::EpsMode,
|
||||
std::vector<size_t>,
|
||||
NormalizeL2TransformationTestValues> NormalizeL2TransformationParams;
|
||||
|
||||
class NormalizeL2Transformation : public LayerTransformation, public testing::WithParamInterface<NormalizeL2TransformationParams> {
|
||||
public:
|
||||
void SetUp() override {
|
||||
const ngraph::element::Type precision = std::get<0>(GetParam());
|
||||
const ngraph::Shape shape = std::get<1>(GetParam());
|
||||
const ngraph::op::EpsMode epsMode = std::get<2>(GetParam());
|
||||
const NormalizeL2TransformationTestValues params = std::get<3>(GetParam());
|
||||
ngraph::Shape shape;
|
||||
ngraph::op::EpsMode epsMode;
|
||||
std::vector<size_t> axes;
|
||||
NormalizeL2TransformationTestValues params;
|
||||
std::tie(shape, epsMode, axes, params) = GetParam();
|
||||
|
||||
actualFunction = ngraph::builder::subgraph::NormalizeL2Function::getOriginal(
|
||||
precision,
|
||||
params.actual.inputPrecision,
|
||||
shape,
|
||||
epsMode,
|
||||
params.actual);
|
||||
axes,
|
||||
params.actual.dequantization);
|
||||
|
||||
SimpleLowPrecisionTransformer transform;
|
||||
transform.add<low_precision::NormalizeL2Transformation, ngraph::opset1::NormalizeL2>(
|
||||
low_precision::LayerTransformation::Params(params.transformationParams));
|
||||
transform.transform(actualFunction);
|
||||
|
||||
referenceFunction = !params.expected.subtractValues.empty() ?
|
||||
ngraph::builder::subgraph::NormalizeL2Function::getOriginal(
|
||||
precision,
|
||||
referenceFunction = ngraph::builder::subgraph::NormalizeL2Function::getReference(
|
||||
params.expected.inputPrecision,
|
||||
shape,
|
||||
epsMode,
|
||||
params.actual) :
|
||||
ngraph::builder::subgraph::NormalizeL2Function::getReference(
|
||||
precision,
|
||||
shape,
|
||||
epsMode,
|
||||
params.expected);
|
||||
axes,
|
||||
params.expected.dequantizationBefore,
|
||||
params.expected.precisionAfterOperation,
|
||||
params.expected.dequantizationAfter);
|
||||
}
|
||||
|
||||
static std::string getTestCaseName(testing::TestParamInfo<NormalizeL2TransformationParams> obj) {
|
||||
ngraph::element::Type precision;
|
||||
ngraph::Shape shape;
|
||||
ngraph::Shape axes;
|
||||
ngraph::op::EpsMode epsMode;
|
||||
NormalizeL2TransformationTestValues params;
|
||||
std::tie(precision, shape, epsMode, params) = obj.param;
|
||||
std::tie(shape, epsMode, axes, params) = obj.param;
|
||||
|
||||
std::ostringstream result;
|
||||
result << toString(params.transformationParams) << precision << "_" << shape << "_" <<
|
||||
axes << epsMode << params.actual << params.expected;
|
||||
result <<
|
||||
toString(params.transformationParams) << shape << "_" <<
|
||||
axes << "_" << epsMode << "_" << params.actual.inputPrecision << "_" <<
|
||||
params.actual.dequantization;
|
||||
return result.str();
|
||||
}
|
||||
};
|
||||
@ -87,13 +101,8 @@ TEST_P(NormalizeL2Transformation, CompareFunctions) {
|
||||
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 = {
|
||||
{ 1, 4, 16, 16 }
|
||||
{ 1, 3, 16, 16 }
|
||||
};
|
||||
|
||||
std::vector<ngraph::op::EpsMode> epsMode = {
|
||||
@ -101,37 +110,151 @@ std::vector<ngraph::op::EpsMode> epsMode = {
|
||||
ngraph::op::EpsMode::MAX
|
||||
};
|
||||
|
||||
std::vector<std::vector<size_t>> axes = {
|
||||
{ 1 },
|
||||
{ 1, 2, 3 }
|
||||
};
|
||||
|
||||
const std::vector<NormalizeL2TransformationTestValues> normalizeL2TransformationTestValues = {
|
||||
{
|
||||
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
|
||||
// U8 per tensor quantization
|
||||
{
|
||||
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(),
|
||||
{ ngraph::element::u8, { 1, 2, 3 }, { }, { 12.3f }},
|
||||
{ ngraph::element::u8, { 1, 2, 3 }, { }, { 1.f }}
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{{ngraph::element::f32}, {}, {-12.3f}}
|
||||
},
|
||||
|
||||
// I8
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{},
|
||||
ngraph::element::f32,
|
||||
{{}, {}, {-1.f}}
|
||||
}
|
||||
},
|
||||
// U8 per channel quantization with the same values
|
||||
{
|
||||
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(),
|
||||
{ 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(),
|
||||
{ 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,
|
||||
NormalizeL2Transformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(precisions),
|
||||
::testing::ValuesIn(shapes),
|
||||
::testing::ValuesIn(epsMode),
|
||||
::testing::ValuesIn(axes),
|
||||
::testing::ValuesIn(normalizeL2TransformationTestValues)),
|
||||
NormalizeL2Transformation::getTestCaseName);
|
||||
|
@ -30,7 +30,9 @@ public:
|
||||
|
||||
class Expected {
|
||||
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;
|
||||
};
|
||||
|
||||
@ -73,7 +75,9 @@ public:
|
||||
|
||||
referenceFunction = ngraph::builder::subgraph::SplitFunction::getReference(
|
||||
testValues.inputShape,
|
||||
testValues.expected.precision,
|
||||
testValues.expected.inputPrecision,
|
||||
testValues.expected.dequantizationBefore,
|
||||
testValues.expected.precisionAfterOperation,
|
||||
testValues.expected.dequantizationAfter,
|
||||
testValues.splitedAxis,
|
||||
testValues.numSplits);
|
||||
@ -114,6 +118,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
|
||||
},
|
||||
// ExpectedValues
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{},
|
||||
ngraph::element::u8,
|
||||
{
|
||||
{{ngraph::element::f32}, {128.f}, {3.f}},
|
||||
@ -131,6 +137,8 @@ const std::vector<SplitTransformationTestValues> testValues = {
|
||||
},
|
||||
{
|
||||
ngraph::element::i8,
|
||||
{},
|
||||
ngraph::element::u8,
|
||||
{
|
||||
{{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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
ngraph::element::f32,
|
||||
{},
|
||||
ngraph::element::f32,
|
||||
{
|
||||
{
|
||||
|
@ -30,7 +30,9 @@ public:
|
||||
|
||||
class Expected {
|
||||
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;
|
||||
};
|
||||
|
||||
@ -86,7 +88,9 @@ public:
|
||||
|
||||
referenceFunction = ngraph::builder::subgraph::VariadicSplitFunction::getReference(
|
||||
testValues.inputShape,
|
||||
testValues.expected.precision,
|
||||
testValues.expected.inputPrecision,
|
||||
testValues.expected.dequantizationBefore,
|
||||
testValues.expected.precisionAfterOperation,
|
||||
testValues.expected.dequantizationAfter,
|
||||
testValues.axis,
|
||||
testValues.splitLengths);
|
||||
@ -126,6 +130,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
|
||||
},
|
||||
// ExpectedValues
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{},
|
||||
ngraph::element::u8,
|
||||
{
|
||||
{{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::i8,
|
||||
{},
|
||||
ngraph::element::i8,
|
||||
{
|
||||
{{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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
ngraph::element::i8,
|
||||
{},
|
||||
ngraph::element::i8,
|
||||
{
|
||||
{
|
||||
@ -262,6 +278,8 @@ const std::vector<VariadicSplitTransformationTestValues> testValues = {
|
||||
{{ngraph::element::f32}, {128.f}, {3.f}}
|
||||
},
|
||||
{
|
||||
ngraph::element::u8,
|
||||
{},
|
||||
ngraph::element::u8,
|
||||
{
|
||||
{{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::i8,
|
||||
{},
|
||||
ngraph::element::i8,
|
||||
{
|
||||
{{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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
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}}}
|
||||
},
|
||||
{
|
||||
ngraph::element::f32,
|
||||
{},
|
||||
ngraph::element::f32,
|
||||
{
|
||||
{
|
||||
|
@ -19,48 +19,48 @@ const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
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 }, { -128.f }, { 127.f } },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.8f }, { 12.7f } },
|
||||
false,
|
||||
{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 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
|
||||
false,
|
||||
{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 } },
|
||||
true,
|
||||
{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 } },
|
||||
true,
|
||||
{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 }, { -127.f }, { 128.f } },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.7f }, { 12.8f } },
|
||||
false,
|
||||
{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 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
|
||||
false,
|
||||
{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 } },
|
||||
true,
|
||||
{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 } },
|
||||
true,
|
||||
{ngraph::element::u8}, {ngraph::element::u8, ngraph::element::f32}
|
||||
|
@ -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::ValuesIn(netPrecisions),
|
||||
::testing::Values(ngraph::Shape({ 1, 6, 10, 10 })),
|
||||
|
@ -11,16 +11,16 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
// InferenceEngine::Precision::FP16
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8()
|
||||
const std::vector<ngraph::pass::low_precision::LayerTransformation::Params> trasformationParamValues = {
|
||||
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 } },
|
||||
{ 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,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(testValues)),
|
||||
|
@ -12,13 +12,13 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
// InferenceEngine::Precision::FP16
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8()
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
|
||||
};
|
||||
|
||||
const std::vector<FakeQuantizePrecisionSelectionTransformationTestValues> testValues = {
|
||||
@ -59,7 +59,7 @@ const std::vector<FakeQuantizePrecisionSelectionTransformationTestValues> testVa
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, FakeQuantizePrecisionSelectionTransformation,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(testValues)),
|
||||
|
@ -12,17 +12,17 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
// InferenceEngine::Precision::FP16
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
// can not be passed to plugin
|
||||
// nGraph: I8 -> FP32 Convert is not supported
|
||||
// LayerTestsUtils::LayerTransformationParamsFactory::createParams(),
|
||||
// LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8()
|
||||
// LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams(),
|
||||
// LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
|
||||
};
|
||||
|
||||
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,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(fakeQuantizeOnDataValues)),
|
||||
|
@ -12,12 +12,12 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8()
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
|
||||
};
|
||||
|
||||
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,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(fakeQuantizeOnDataValues)),
|
||||
|
@ -11,20 +11,20 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::FP16
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<InferenceEngine::SizeVector> dimensions = {
|
||||
InferenceEngine::SizeVector({ 1, 3, 16, 16 })
|
||||
const std::vector<ngraph::Shape> dimensions = {
|
||||
{ 1, 3, 16, 16 }
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParams().setSupportAsymmetricQuantization(true),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParams().setSupportAsymmetricQuantization(false),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8()
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setSupportAsymmetricQuantization(true),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setSupportAsymmetricQuantization(false),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, GemmTransformation,
|
||||
|
@ -99,16 +99,10 @@ std::shared_ptr<InferenceEngine::ICNNNetwork> convert(std::shared_ptr<ngraph::Fu
|
||||
|
||||
std::shared_ptr<ngraph::Function> LayerTransformation::transformNGraph(
|
||||
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);
|
||||
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);
|
||||
transformer.transform(nGraphFunc);
|
||||
|
||||
|
@ -10,8 +10,8 @@
|
||||
using namespace LayerTestsDefinitions;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32
|
||||
};
|
||||
|
||||
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 = {
|
||||
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>({ InferenceEngine::SizeVector({ 1, 16 }), InferenceEngine::SizeVector({ 10, 16 }) }),
|
||||
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>({ InferenceEngine::SizeVector({ 1, 16 }), InferenceEngine::SizeVector({ 16, 10 }) })
|
||||
const std::vector<std::pair<ngraph::Shape, ngraph::Shape>> inputShapes = {
|
||||
std::pair<ngraph::Shape, ngraph::Shape>({ 1, 16 }, { 10, 16 }),
|
||||
std::pair<ngraph::Shape, ngraph::Shape>({ 1, 16 }, { 16, 10 })
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, MatMulWithOptimizedConstantFakeQuantizeTransformation,
|
||||
|
@ -10,9 +10,9 @@
|
||||
using namespace LayerTestsDefinitions;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
// InferenceEngine::Precision::FP16
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<MultiplyWithOneParentTransformationValues> values = {
|
||||
@ -24,7 +24,7 @@ const std::vector<MultiplyWithOneParentTransformationValues> values = {
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, MultiplyWithOneParentTransformation,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(values)),
|
||||
MultiplyWithOneParentTransformation::getTestCaseName);
|
||||
|
@ -15,18 +15,18 @@ const std::vector<ngraph::element::Type> precisions = {
|
||||
ngraph::element::f32
|
||||
};
|
||||
|
||||
std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> testValues = {
|
||||
{},
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} },
|
||||
{ 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} },
|
||||
{ 256ul, ngraph::Shape({}), {12.75f}, {25.5f}, {12.75f}, {25.5f} },
|
||||
{ 256ul, ngraph::Shape({}), {-12.8f / 2.f}, {12.7f}, {-12.8f / 2.f}, {12.7f} }
|
||||
std::vector<PReluTestValues> testValues = {
|
||||
{ {}, false},
|
||||
{ { 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }, false },
|
||||
{ { 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} }, true },
|
||||
{ { 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} }, true }
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, PReluTransformation,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(testValues)),
|
||||
PReluTransformation::getTestCaseName);
|
||||
|
@ -16,12 +16,12 @@ const std::vector<ngraph::element::Type> precisions = {
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> testValues = {
|
||||
{},
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} },
|
||||
{ 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} },
|
||||
{ 256ul, ngraph::Shape({}), {12.75f}, {25.5f}, {12.75f}, {25.5f} },
|
||||
{ 256ul, ngraph::Shape({}), {-12.8f / 2.f}, {12.7f}, {-12.8f / 2.f}, {12.7f} }
|
||||
std::vector<ReluTestValues> testValues = {
|
||||
{ {}, false},
|
||||
{ { 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }, false },
|
||||
{ { 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} }, true },
|
||||
{ { 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} }, true }
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, ReluTransformation,
|
||||
|
@ -27,18 +27,21 @@ const std::vector<ReshapeTransformationParam> params = {
|
||||
ngraph::Shape{ 1, 3, 32 },
|
||||
{ 1, 3, 4, 8 },
|
||||
{ 256ul, ngraph::Shape{ 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
|
||||
true
|
||||
},
|
||||
// 4D -> 3D
|
||||
{
|
||||
ngraph::Shape{ 1, 3, 16, 16 },
|
||||
{ 1, 3, 256 },
|
||||
{ 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
|
||||
true
|
||||
},
|
||||
// 4D -> 2D
|
||||
{
|
||||
ngraph::Shape{ 1, 3, 4, 8 },
|
||||
{ 1, -1 },
|
||||
{ 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
|
||||
true
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -11,36 +11,36 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> precisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
const std::vector<ngraph::element::Type> precisions = {
|
||||
ngraph::element::f32
|
||||
};
|
||||
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(false),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(true),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(false),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(true),
|
||||
};
|
||||
|
||||
const std::vector<LayerTestsDefinitions::SqueezeTransformationParam> params = {
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 0, 3 },
|
||||
{ 3 },
|
||||
{ 1, 3, 5, 1}
|
||||
},
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 0, 1, 2 },
|
||||
{ 2, 3 },
|
||||
{ 1, 1, 1, 1 }
|
||||
},
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 0, 3 },
|
||||
{ 3 },
|
||||
{ 1, 64, 32, 1 }
|
||||
},
|
||||
{
|
||||
{ 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 }
|
||||
}
|
||||
};
|
||||
|
@ -44,19 +44,18 @@ const std::vector<SubtractMultiplyToMultiplyAddTransformationTestValues> testVal
|
||||
{2.55f, 2.55f / 2.f, 2.55f / 3.f}
|
||||
},
|
||||
},
|
||||
// TODO: uncomment test
|
||||
//{
|
||||
// {1, 3, 16, 16},
|
||||
// ngraph::element::f32,
|
||||
// {
|
||||
// 256ul,
|
||||
// ngraph::Shape({1}),
|
||||
// {2.55f / 2},
|
||||
// {2.55f},
|
||||
// {2.55f / 2},
|
||||
// {2.55f}
|
||||
// },
|
||||
//},
|
||||
{
|
||||
{1, 3, 16, 16},
|
||||
ngraph::element::f32,
|
||||
{
|
||||
256ul,
|
||||
ngraph::Shape({1}),
|
||||
{2.55f / 2},
|
||||
{2.55f},
|
||||
{2.55f / 2},
|
||||
{2.55f}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, SubtractMultiplyToMultiplyAddTransformation,
|
||||
|
@ -11,21 +11,21 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::FP16
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParams().setUpdatePrecisions(true),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParams().setUpdatePrecisions(false),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8()
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setUpdatePrecisions(true),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setUpdatePrecisions(false),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, SubtractTransformation,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues)),
|
||||
SubtractTransformation::getTestCaseName);
|
||||
|
@ -11,15 +11,15 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::FP16
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParams().setUpdatePrecisions(true),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParams().setUpdatePrecisions(false),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8()
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setUpdatePrecisions(true),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams().setUpdatePrecisions(false),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
|
||||
};
|
||||
|
||||
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,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(perTensorValues),
|
||||
|
@ -11,42 +11,42 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> precisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
const std::vector<ngraph::element::Type> precisions = {
|
||||
ngraph::element::f32
|
||||
};
|
||||
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(false),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(true),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(false),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(true),
|
||||
};
|
||||
|
||||
const std::vector<LayerTestsDefinitions::UnsqueezeTransformationParam> params = {
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 0.0, 3.0 },
|
||||
{ 3.0 },
|
||||
{ 3, 3, 5}
|
||||
},
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 0.0, 1.0 },
|
||||
{ 3, 3, 3 }
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.8f }, { 12.7f } },
|
||||
{ 3.0 },
|
||||
{ 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, 4, 5, 6 }
|
||||
},
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 0.0, 3.0 },
|
||||
{ 1, 32, 2}
|
||||
{ 256ul, ngraph::Shape { 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 2.0, 3.0 },
|
||||
{ 3, 4 }
|
||||
},
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 0.0, 1.0 },
|
||||
{ 46, 128, 2 }
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 4.0 },
|
||||
{ 46, 128, 2, 3 }
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -19,48 +19,48 @@ const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
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 }, { -128.f }, { 127.f } },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.8f }, { 12.7f } },
|
||||
false,
|
||||
{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 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
|
||||
false,
|
||||
{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 } },
|
||||
true,
|
||||
{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 } },
|
||||
true,
|
||||
{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 }, { -127.f }, { 128.f } },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.7f }, { 12.8f } },
|
||||
false,
|
||||
{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 }, { 0.f }, { 255.f }, { 0.f }, { 255.f } },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
|
||||
false,
|
||||
{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 } },
|
||||
true,
|
||||
{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 } },
|
||||
true,
|
||||
{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,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(params)),
|
||||
AddTransformation::getTestCaseName);
|
||||
|
@ -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::ValuesIn(netPrecisions),
|
||||
::testing::Values(ngraph::Shape({ 1, 6, 10, 10 })),
|
||||
|
@ -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 } },
|
||||
false
|
||||
},
|
||||
// {
|
||||
// { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 1.f }, { 25.5f } },
|
||||
// true,
|
||||
// { 255ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 254.f }, { -12.7f }, { 12.7f } },
|
||||
// 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
|
||||
// }
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.75f }, { 6.375f } },
|
||||
true,
|
||||
{ 255ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 254.f }, { -12.7f }, { 12.7f } },
|
||||
false
|
||||
}
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, ConvolutionTransformation,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(params)),
|
||||
@ -81,8 +75,8 @@ const std::vector<LayerTestsDefinitions::ConvolutionWIthIncorrectWeightsParam> i
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, ConvolutionWIthIncorrectWeightsTransformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })),
|
||||
::testing::Values(CommonTestUtils::DEVICE_CPU),
|
||||
::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })),
|
||||
::testing::Values(CommonTestUtils::DEVICE_GPU),
|
||||
::testing::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(incorrectWeightsParams)),
|
||||
ConvolutionWIthIncorrectWeightsTransformation::getTestCaseName);
|
||||
|
@ -11,16 +11,16 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
// InferenceEngine::Precision::FP16
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
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 } },
|
||||
{ 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,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(testValues)),
|
||||
|
@ -12,13 +12,13 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
// InferenceEngine::Precision::FP16
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8()
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
|
||||
};
|
||||
|
||||
const std::vector<FakeQuantizePrecisionSelectionTransformationTestValues> testValues = {
|
||||
@ -60,7 +60,7 @@ const std::vector<FakeQuantizePrecisionSelectionTransformationTestValues> testVa
|
||||
INSTANTIATE_TEST_CASE_P(DISABLED_LPT, FakeQuantizePrecisionSelectionTransformation,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(testValues)),
|
||||
|
@ -12,17 +12,17 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
// InferenceEngine::Precision::FP16
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
// can not be passed to plugin
|
||||
// nGraph: I8 -> FP32 Convert is not supported
|
||||
// LayerTestsUtils::LayerTransformationParamsFactory::createParams(),
|
||||
// LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8()
|
||||
// LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams(),
|
||||
// LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
|
||||
};
|
||||
|
||||
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,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(fakeQuantizeOnDataValues)),
|
||||
|
@ -12,12 +12,12 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8()
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8()
|
||||
};
|
||||
|
||||
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,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(fakeQuantizeOnDataValues)),
|
||||
|
@ -11,16 +11,16 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
};
|
||||
|
||||
const std::vector<InferenceEngine::SizeVector> dimensions = {
|
||||
InferenceEngine::SizeVector({ 1, 3, 16, 16 })
|
||||
const std::vector<ngraph::Shape> dimensions = {
|
||||
{1, 3, 16, 16}
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8()
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8()
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, GemmTransformation,
|
||||
|
@ -132,17 +132,12 @@ std::shared_ptr<InferenceEngine::ICNNNetwork> convert(std::shared_ptr<ngraph::Fu
|
||||
|
||||
std::shared_ptr<ngraph::Function> LayerTransformation::transformNGraph(
|
||||
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);
|
||||
|
||||
InferenceEngine::NetPass::ConvertPrecision(*clonedNetwork, InferenceEngine::Precision::FP16, InferenceEngine::Precision::FP32);
|
||||
|
||||
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);
|
||||
transformer.transform(nGraphFunc);
|
||||
|
@ -33,7 +33,7 @@ std::vector<MatMulTransformationTestValues> testValues = {
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, MatMulTransformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(precisions),
|
||||
::testing::Values(InferenceEngine::SizeVector({ 1, 384, 1024 })),
|
||||
::testing::Values(ngraph::Shape({ 1, 384, 1024 })),
|
||||
::testing::Values(CommonTestUtils::DEVICE_GPU),
|
||||
::testing::ValuesIn(testValues)),
|
||||
MatMulTransformation::getTestCaseName);
|
||||
|
@ -10,8 +10,8 @@
|
||||
using namespace LayerTestsDefinitions;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
};
|
||||
|
||||
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 = {
|
||||
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>({ InferenceEngine::SizeVector({ 1, 16 }), InferenceEngine::SizeVector({ 10, 16 }) }),
|
||||
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>({ InferenceEngine::SizeVector({ 1, 16 }), InferenceEngine::SizeVector({ 16, 10 }) })
|
||||
const std::vector<std::pair<ngraph::Shape, ngraph::Shape>> inputShapes = {
|
||||
std::pair<ngraph::Shape, ngraph::Shape>({ 1, 16 }, { 10, 16 }),
|
||||
std::pair<ngraph::Shape, ngraph::Shape>({ 1, 16 }, { 16, 10 })
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, MatMulWithOptimizedConstantFakeQuantizeTransformation,
|
||||
|
@ -70,7 +70,7 @@ const std::vector<LayerTestsDefinitions::MultiplyTestValues> params = {
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, MultiplyTransformation,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(params)),
|
||||
MultiplyTransformation::getTestCaseName);
|
||||
|
@ -10,9 +10,9 @@
|
||||
using namespace LayerTestsDefinitions;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
// InferenceEngine::Precision::FP16
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
const std::vector<MultiplyWithOneParentTransformationValues> values = {
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "low_precision_transformations/relu_transformation.hpp"
|
||||
#include "low_precision_transformations/prelu_transformation.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
|
||||
using namespace LayerTestsDefinitions;
|
||||
@ -12,23 +12,22 @@ using namespace InferenceEngine::details;
|
||||
|
||||
namespace {
|
||||
const std::vector<ngraph::element::Type> precisions = {
|
||||
ngraph::element::f32,
|
||||
// ngraph::element::f16
|
||||
ngraph::element::f32
|
||||
};
|
||||
|
||||
std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> testValues = {
|
||||
{},
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} },
|
||||
{ 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} },
|
||||
{ 256ul, ngraph::Shape({}), {12.75f}, {25.5f}, {12.75f}, {25.5f} },
|
||||
{ 256ul, ngraph::Shape({}), {-12.8f / 2.f}, {12.7f}, {-12.8f / 2.f}, {12.7f} }
|
||||
std::vector<PReluTestValues> testValues = {
|
||||
{ {}, false},
|
||||
{ { 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }, false },
|
||||
{ { 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} }, true },
|
||||
{ { 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} }, true }
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, ReluTransformation,
|
||||
INSTANTIATE_TEST_CASE_P(LPT, PReluTransformation,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(testValues)),
|
||||
ReluTransformation::getTestCaseName);
|
||||
PReluTransformation::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -16,18 +16,18 @@ const std::vector<ngraph::element::Type> precisions = {
|
||||
// ngraph::element::f16
|
||||
};
|
||||
|
||||
std::vector<ngraph::builder::subgraph::FakeQuantizeOnData> testValues = {
|
||||
{},
|
||||
{ 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} },
|
||||
{ 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} },
|
||||
{ 256ul, ngraph::Shape({}), {12.75f}, {25.5f}, {12.75f}, {25.5f} },
|
||||
{ 256ul, ngraph::Shape({}), {-12.8f / 2.f}, {12.7f}, {-12.8f / 2.f}, {12.7f} }
|
||||
std::vector<ReluTestValues> testValues = {
|
||||
{ {}, false},
|
||||
{ { 256ul, ngraph::Shape({}), {0.f}, {25.5f}, {0.f}, {25.5f} }, false },
|
||||
{ { 256ul, ngraph::Shape({}), {-12.8f}, {12.7f}, {-12.8f}, {12.7f} }, true },
|
||||
{ { 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} }, true }
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, ReluTransformation,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(testValues)),
|
||||
ReluTransformation::getTestCaseName);
|
||||
|
@ -27,18 +27,21 @@ const std::vector<ReshapeTransformationParam> params = {
|
||||
ngraph::Shape{ 1, 3, 32 },
|
||||
{ 1, 3, 4, 8 },
|
||||
{ 256ul, ngraph::Shape{ 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } },
|
||||
true
|
||||
},
|
||||
// 4D -> 3D
|
||||
{
|
||||
ngraph::Shape{ 1, 3, 16, 16 },
|
||||
{ 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
|
||||
{
|
||||
ngraph::Shape{ 1, 3, 4, 8 },
|
||||
{ 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
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -11,43 +11,43 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> precisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
};
|
||||
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(false),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(true),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(false),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(true),
|
||||
};
|
||||
|
||||
const std::vector<LayerTestsDefinitions::SqueezeTransformationParam> params = {
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } },
|
||||
{ 0.0, 3.0 },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 3 },
|
||||
{ 1, 3, 5, 1}
|
||||
},
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } },
|
||||
{ 0.0, 1.0, 2.0 },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 2, 3 },
|
||||
{ 1, 1, 1, 1 }
|
||||
},
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } },
|
||||
{ 0.0, 3.0 },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 3 },
|
||||
{ 1, 64, 32, 1 }
|
||||
},
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } },
|
||||
{ 0.0, 2.0, 3.0 },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 2.0, 3.0 },
|
||||
{ 1, 32, 1, 1 }
|
||||
}
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, SqueezeTransformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(precisions),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_GPU),
|
||||
::testing::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(params)),
|
||||
|
@ -43,19 +43,18 @@ const std::vector<SubtractMultiplyToMultiplyAddTransformationTestValues> testVal
|
||||
{2.55f, 2.55f / 2.f, 2.55f / 3.f}
|
||||
},
|
||||
},
|
||||
// TODO: uncomment test
|
||||
// {
|
||||
// {1, 3, 16, 16},
|
||||
// ngraph::element::f32,
|
||||
// {
|
||||
// 256ul,
|
||||
// ngraph::Shape({1}),
|
||||
// {2.55f / 2},
|
||||
// {2.55f},
|
||||
// {2.55f / 2},
|
||||
// {2.55f}
|
||||
// },
|
||||
// },
|
||||
{
|
||||
{1, 3, 16, 16},
|
||||
ngraph::element::f32,
|
||||
{
|
||||
256ul,
|
||||
ngraph::Shape({1}),
|
||||
{2.55f / 2},
|
||||
{2.55f},
|
||||
{2.55f / 2},
|
||||
{2.55f}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, SubtractMultiplyToMultiplyAddTransformation,
|
||||
|
@ -11,18 +11,18 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParams()
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams()
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, SubtractTransformation,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues)),
|
||||
SubtractTransformation::getTestCaseName);
|
||||
|
@ -11,12 +11,12 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
};
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParams()
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParams()
|
||||
};
|
||||
|
||||
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,
|
||||
::testing::Combine(
|
||||
::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::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(perTensorValues),
|
||||
|
@ -11,48 +11,48 @@ using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::pass::low_precision;
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> precisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
const std::vector<ngraph::element::Type> netPrecisions = {
|
||||
ngraph::element::f32,
|
||||
};
|
||||
|
||||
|
||||
const std::vector<LayerTransformation::Params> trasformationParamValues = {
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsU8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(false),
|
||||
LayerTestsUtils::LayerTransformationParamsFactory::createParamsI8I8().setUpdatePrecisions(true),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(false),
|
||||
LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsI8I8().setUpdatePrecisions(true),
|
||||
};
|
||||
|
||||
const std::vector<LayerTestsDefinitions::UnsqueezeTransformationParam> params = {
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } },
|
||||
{ 0.0, 3.0 },
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 3.0 },
|
||||
{ 3, 3, 5}
|
||||
},
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } },
|
||||
{ 0.0, 1.0 },
|
||||
{ 3, 3, 3 }
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 255.f }, { -12.8f }, { 12.7f } },
|
||||
{ 3.0 },
|
||||
{ 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, 4, 5, 6 }
|
||||
},
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } },
|
||||
{ 0.0, 3.0 },
|
||||
{ 1, 32, 2}
|
||||
{ 256ul, ngraph::Shape { 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 2.0, 3.0 },
|
||||
{ 3, 4 }
|
||||
},
|
||||
{
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1 }, { 0.f }, { 255.f }, { -128.f }, { 127.f } },
|
||||
{ 0.0, 1.0 },
|
||||
{ 46, 128, 2 }
|
||||
{ 256ul, ngraph::Shape { 1, 1, 1, 1 }, { -12.8f }, { 12.7f }, { -12.8f }, { 12.7f } },
|
||||
{ 4.0 },
|
||||
{ 46, 128, 2, 3 }
|
||||
}
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(smoke_LPT, UnsqueezeTransformation,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(precisions),
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::Values(CommonTestUtils::DEVICE_GPU),
|
||||
::testing::ValuesIn(trasformationParamValues),
|
||||
::testing::ValuesIn(params)),
|
||||
|
@ -35,6 +35,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -33,6 +33,6 @@ public:
|
||||
protected:
|
||||
void SetUp() override;
|
||||
private:
|
||||
void validateNGraph();
|
||||
void validate();
|
||||
};
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -33,6 +33,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -35,6 +35,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -29,6 +29,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -26,6 +26,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -43,7 +43,7 @@ protected:
|
||||
void Run() override;
|
||||
|
||||
private:
|
||||
void validateNGraph();
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -36,6 +36,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -27,6 +27,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -27,6 +27,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -13,13 +13,19 @@
|
||||
#include "lpt_ngraph_functions/fake_quantize_and_two_output_branches_with_convolution_function.hpp"
|
||||
|
||||
namespace LayerTestsDefinitions {
|
||||
class FakeQuantizeAndTwoOutputBranchesWithConvolution {
|
||||
public:
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fqOnData;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fqOnWeights1;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fqOnWeights2;
|
||||
};
|
||||
|
||||
typedef std::tuple<
|
||||
InferenceEngine::Precision,
|
||||
InferenceEngine::SizeVector,
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
std::string,
|
||||
ngraph::pass::low_precision::LayerTransformation::Params,
|
||||
ngraph::builder::subgraph::FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::ActualValues
|
||||
FakeQuantizeAndTwoOutputBranchesWithConvolution
|
||||
> FakeQuantizeAndTwoOutputBranchesWithConvolutionParams;
|
||||
|
||||
class FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation :
|
||||
@ -30,6 +36,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -49,8 +49,8 @@ inline std::ostream& operator<<(std::ostream& out, const FakeQuantizePrecisionSe
|
||||
}
|
||||
|
||||
typedef std::tuple<
|
||||
InferenceEngine::Precision,
|
||||
InferenceEngine::SizeVector,
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
std::string,
|
||||
ngraph::pass::low_precision::LayerTransformation::Params,
|
||||
FakeQuantizePrecisionSelectionTransformationTestValues> FakeQuantizeTransformationParams;
|
||||
@ -63,6 +63,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -11,10 +11,9 @@
|
||||
|
||||
namespace LayerTestsDefinitions {
|
||||
|
||||
// ngraph::builder::subgraph::FakeQuantizeOnData
|
||||
typedef std::tuple<
|
||||
InferenceEngine::Precision,
|
||||
InferenceEngine::SizeVector,
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
std::string,
|
||||
ngraph::pass::low_precision::LayerTransformation::Params,
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData> FakeQuantizeTransformationParams;
|
||||
@ -27,6 +26,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -33,6 +33,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -12,8 +12,8 @@
|
||||
namespace LayerTestsDefinitions {
|
||||
|
||||
typedef std::tuple<
|
||||
InferenceEngine::Precision,
|
||||
InferenceEngine::SizeVector,
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
std::string,
|
||||
ngraph::pass::low_precision::LayerTransformation::Params,
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData> FuseFakeQuantizeAndScaleShiftTransformationParams;
|
||||
@ -26,6 +26,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -43,6 +43,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -39,6 +39,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -39,6 +39,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -11,15 +11,24 @@
|
||||
|
||||
namespace LayerTestsDefinitions {
|
||||
|
||||
typedef std::tuple<
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
std::string,
|
||||
ngraph::pass::low_precision::LayerTransformation::Params> GemmTransformationParams;
|
||||
|
||||
// TODO: use MatMulTransformation
|
||||
class GemmTransformation :
|
||||
public testing::WithParamInterface<LayerTestsUtils::LayerTransformationParams>,
|
||||
public testing::WithParamInterface<GemmTransformationParams>,
|
||||
public LayerTestsUtils::LayerTransformation {
|
||||
public:
|
||||
static std::string getTestCaseName(testing::TestParamInfo<LayerTestsUtils::LayerTransformationParams> obj);
|
||||
static std::string getTestCaseName(testing::TestParamInfo<GemmTransformationParams> obj);
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -39,7 +39,7 @@ protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validateNGraph();
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -49,6 +49,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -36,6 +36,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -41,6 +41,9 @@ protected:
|
||||
void SetUp() override;
|
||||
|
||||
void Run() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -19,8 +19,8 @@ public:
|
||||
};
|
||||
|
||||
typedef std::tuple<
|
||||
InferenceEngine::Precision,
|
||||
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>,
|
||||
ngraph::element::Type,
|
||||
std::pair<ngraph::Shape, ngraph::Shape>,
|
||||
std::string,
|
||||
MatMulWithOptimizedConstantFakeQuantizeTransformationTestValues
|
||||
> MatMulWithOptimizedConstantFakeQuantizeTransformationTransformationParams;
|
||||
@ -33,6 +33,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -36,6 +36,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -18,8 +18,8 @@ public:
|
||||
};
|
||||
|
||||
typedef std::tuple<
|
||||
InferenceEngine::Precision,
|
||||
InferenceEngine::SizeVector,
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
std::string,
|
||||
MultiplyWithOneParentTransformationValues
|
||||
> MultiplyWithOneParentTransformationParams;
|
||||
|
@ -29,6 +29,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -28,6 +28,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -11,11 +11,17 @@
|
||||
|
||||
namespace LayerTestsDefinitions {
|
||||
|
||||
class PReluTestValues {
|
||||
public:
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize;
|
||||
bool isSubtract;
|
||||
};
|
||||
|
||||
typedef std::tuple<
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
std::string,
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData> PReluTransformationParams;
|
||||
PReluTestValues> PReluTransformationParams;
|
||||
|
||||
class PReluTransformation :
|
||||
public testing::WithParamInterface<PReluTransformationParams>,
|
||||
@ -26,6 +32,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -11,11 +11,17 @@
|
||||
|
||||
namespace LayerTestsDefinitions {
|
||||
|
||||
class ReluTestValues {
|
||||
public:
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize;
|
||||
bool isSubtract;
|
||||
};
|
||||
|
||||
typedef std::tuple<
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
std::string,
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData> ReluTransformationParams;
|
||||
ReluTestValues> ReluTransformationParams;
|
||||
|
||||
class ReluTransformation :
|
||||
public testing::WithParamInterface<ReluTransformationParams>,
|
||||
@ -26,6 +32,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -17,6 +17,7 @@ public:
|
||||
ngraph::Shape inputShape;
|
||||
std::vector<int> reshapeConstValues;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize;
|
||||
bool isTransformed;
|
||||
};
|
||||
|
||||
typedef std::tuple<
|
||||
@ -34,6 +35,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -33,6 +33,6 @@ protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validateNGraph();
|
||||
void validate();
|
||||
};
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
std::string stringifySqueezeArgs(const std::vector<float>& axes);
|
||||
|
||||
typedef std::tuple<
|
||||
InferenceEngine::Precision,
|
||||
ngraph::element::Type,
|
||||
std::string,
|
||||
ngraph::pass::low_precision::LayerTransformation::Params,
|
||||
SqueezeTransformationParam
|
||||
@ -37,6 +37,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -31,7 +31,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
void validateNGraph();
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -11,11 +11,18 @@
|
||||
|
||||
namespace LayerTestsDefinitions {
|
||||
|
||||
typedef std::tuple<
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
std::string,
|
||||
ngraph::pass::low_precision::LayerTransformation::Params
|
||||
> SubtractTransformationParams;
|
||||
|
||||
class SubtractTransformation :
|
||||
public testing::WithParamInterface<LayerTestsUtils::LayerTransformationParams>,
|
||||
public testing::WithParamInterface<SubtractTransformationParams>,
|
||||
public LayerTestsUtils::LayerTransformation {
|
||||
public:
|
||||
static std::string getTestCaseName(testing::TestParamInfo<LayerTestsUtils::LayerTransformationParams> obj);
|
||||
static std::string getTestCaseName(testing::TestParamInfo<SubtractTransformationParams> obj);
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
@ -12,8 +12,8 @@
|
||||
namespace LayerTestsDefinitions {
|
||||
|
||||
typedef std::tuple<
|
||||
InferenceEngine::Precision,
|
||||
InferenceEngine::SizeVector,
|
||||
ngraph::element::Type,
|
||||
ngraph::Shape,
|
||||
std::string,
|
||||
ngraph::pass::low_precision::LayerTransformation::Params,
|
||||
bool,
|
||||
@ -27,6 +27,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -34,6 +34,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
};
|
||||
|
||||
typedef std::tuple<
|
||||
InferenceEngine::Precision,
|
||||
ngraph::element::Type,
|
||||
std::string,
|
||||
ngraph::pass::low_precision::LayerTransformation::Params,
|
||||
UnsqueezeTransformationParam
|
||||
@ -35,6 +35,9 @@ public:
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validate();
|
||||
};
|
||||
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -33,6 +33,6 @@ protected:
|
||||
void SetUp() override;
|
||||
|
||||
private:
|
||||
void validateNGraph();
|
||||
void validate();
|
||||
};
|
||||
} // namespace LayerTestsDefinitions
|
||||
|
@ -50,42 +50,34 @@ std::string AddTransformation::getTestCaseName(testing::TestParamInfo< AddTransf
|
||||
|
||||
void AddTransformation::SetUp() {
|
||||
ngraph::element::Type precision;
|
||||
ngraph::Shape inputShape1;
|
||||
ngraph::Shape inputShape;
|
||||
AddTestValues param;
|
||||
std::tie(precision, inputShape1, targetDevice, param) = this->GetParam();
|
||||
std::tie(precision, inputShape, targetDevice, param) = this->GetParam();
|
||||
|
||||
ngraph::Shape inputShape2 = inputShape1;
|
||||
|
||||
if (param.broadcast) {
|
||||
inputShape2[2] = 1;
|
||||
inputShape2[3] = 1;
|
||||
}
|
||||
|
||||
auto fq1 = param.fakeQuantize1;
|
||||
auto fq2 = param.fakeQuantize2;
|
||||
|
||||
const auto input1 = std::make_shared<ngraph::opset1::Parameter>(precision, inputShape1);
|
||||
const auto fakeQuantize1 = fq1.empty() ?
|
||||
nullptr :
|
||||
ngraph::builder::makeFakeQuantize(
|
||||
input1, precision, fq1.quantizationLevel, fq1.constantShape,
|
||||
fq1.inputLowValues, fq1.inputHighValues, fq1.outputLowValues, fq1.outputHighValues);
|
||||
|
||||
const auto input2 = std::make_shared<ngraph::opset1::Parameter>(precision, inputShape2);
|
||||
const auto fakeQuantize2 = fq2.empty() ?
|
||||
nullptr :
|
||||
ngraph::builder::makeFakeQuantize(
|
||||
input2, precision, fq2.quantizationLevel, fq2.constantShape,
|
||||
fq2.inputLowValues, fq2.inputHighValues, fq2.outputLowValues, fq2.outputHighValues);
|
||||
|
||||
const auto add = std::make_shared<ngraph::opset1::Add>(
|
||||
fq1.empty() ? input1 : fakeQuantize1,
|
||||
fq2.empty() ? input2 : fakeQuantize2);
|
||||
|
||||
ngraph::ResultVector results{ std::make_shared<ngraph::opset1::Result>(add) };
|
||||
function = std::make_shared<ngraph::Function>(results, ngraph::ParameterVector{ input1, input2 }, "AddTransformation");
|
||||
function = ngraph::builder::subgraph::AddFunction::getOriginal(
|
||||
precision, inputShape, param.broadcast,
|
||||
param.fakeQuantize1, param.fakeQuantize2);
|
||||
|
||||
ngraph::pass::InitNodeInfo().run_on_function(function);
|
||||
validate();
|
||||
}
|
||||
|
||||
void AddTransformation::validate() {
|
||||
ngraph::element::Type precision;
|
||||
ngraph::Shape inputShape;
|
||||
std::string targetDevice;
|
||||
AddTestValues param;
|
||||
std::tie(precision, inputShape, targetDevice, param) = this->GetParam();
|
||||
|
||||
const auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8();
|
||||
const auto transformed = transformNGraph(params, getLowPrecisionTransformationsNGraph(params));
|
||||
|
||||
const auto output = transformed->get_output_op(0);
|
||||
if ((!param.fakeQuantize1.empty()) && (!param.fakeQuantize2.empty())) {
|
||||
const auto scaleShift = output->get_input_node_shared_ptr(0);
|
||||
const std::string typeName = scaleShift->get_type_name();
|
||||
ASSERT_EQ("ScaleShiftIE", typeName);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(AddTransformation, CompareWithRefImpl) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user