Skip to content

Commit

Permalink
Restore formatting in LP test files
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Raasz <pawel.raasz@intel.com>
  • Loading branch information
praasz committed Feb 3, 2025
1 parent 0e722aa commit a5aa6f1
Show file tree
Hide file tree
Showing 10 changed files with 683 additions and 270 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ class LP_TRANSFORMATIONS_API DataPrecision {
hasZeroPoint(hasZeroPoint) {}

bool empty() const noexcept {
assert(((precision == element::dynamic) && (min == 0.f) && (max == 0.f) && (!hasZeroPoint)) ||
((precision != element::dynamic) && (max != 0.f)));
return (precision == element::dynamic) && (min == 0.f) && (max == 0.f) && (!hasZeroPoint);
OPENVINO_SUPPRESS_DEPRECATED_START
assert(((precision == element::dynamic || precisoin == element::undefined) && (min == 0.f) && (max == 0.f) && (!hasZeroPoint)) ||
((precision != element::dynamic && precision != element::undefined) && (max != 0.f)));
return (precision == element::dynamic || precision == element::undefined) && (min == 0.f) && (max == 0.f) && (!hasZeroPoint);
OPENVINO_SUPPRESS_DEPRECATED_END
}

static bool isSupported(const element::Type& precision) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,21 @@ class ConcatWithFQTransformation : public LayerTransformation,
if (!testValues.actual.dequantization2.multiply.empty()) {
testValues.actual.dequantization2.multiply.outPrecision = precision;
}

OPENVINO_SUPPRESS_DEPRECATED_START
actualFunction = ov::builder::subgraph::ConcatFunction::get(precision,
shape,
testValues.actual.fakeQuantize1,
testValues.actual.convert1,
testValues.actual.dequantization1,
testValues.actual.fakeQuantize2,
testValues.actual.convert2,
testValues.actual.dequantization2,
{},
ov::element::dynamic,
{},
testValues.axis,
testValues.addNotPrecisionPreservedOperation);
shape,
testValues.actual.fakeQuantize1,
testValues.actual.convert1,
testValues.actual.dequantization1,
testValues.actual.fakeQuantize2,
testValues.actual.convert2,
testValues.actual.dequantization2,
{},
ov::element::undefined,
{},
testValues.axis,
testValues.addNotPrecisionPreservedOperation);
OPENVINO_SUPPRESS_DEPRECATED_END
auto supportedPrecisionsOnActivation = std::vector<ov::pass::low_precision::PrecisionsRestriction>(
{ov::pass::low_precision::PrecisionsRestriction::create<ov::op::v1::AvgPool>(
{{{0}, testValues.params.precisionsOnActivations}})});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,25 @@ class ConcatWithNotQuantizedParentTransformation :
testValues.actual.dequantization2.multiply.outPrecision = precision;
}

actualFunction = ov::builder::subgraph::ConcatFunction::get(precision,
shapes.first,
testValues.actual.fakeQuantize1,
testValues.actual.convert1,
testValues.actual.dequantization1,
false,
shapes.second,
testValues.actual.fakeQuantize2,
testValues.actual.convert2,
testValues.actual.dequantization2,
true,
{},
ov::element::dynamic,
{},
testValues.axis,
testValues.addNotPrecisionPreservedOperation);
OPENVINO_SUPPRESS_DEPRECATED_START
actualFunction = ov::builder::subgraph::ConcatFunction::get(
precision,
shapes.first,
testValues.actual.fakeQuantize1,
testValues.actual.convert1,
testValues.actual.dequantization1,
false,
shapes.second,
testValues.actual.fakeQuantize2,
testValues.actual.convert2,
testValues.actual.dequantization2,
true,
{},
ov::element::undefined,
{},
testValues.axis,
testValues.addNotPrecisionPreservedOperation);
OPENVINO_SUPPRESS_DEPRECATED_END

auto precisionsRestrictions = std::vector<ov::pass::low_precision::PrecisionsRestriction>({
ov::pass::low_precision::PrecisionsRestriction::create<ov::op::v1::Convolution>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ namespace testValues1 {
const std::vector<int> opset_version = {1, 7, 8};

const std::vector<ov::PartialShape> inputShapes3D = {{3, 3, 4}, {-1, -1, -1}};

const std::vector<GatherTransformationTestValues> testValues = {
// U8: per-tensor quantization
{{1},
{0},
{0},
std::int64_t{0},
LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {{128}, ov::element::f32, {}, true, 1, ov::element::u8, true}, {0.1f}}},
{ov::element::u8,
{{ov::element::f32}, {{128}, ov::element::f32, {}, true, 1, ov::element::u8, true}, {0.1f}}},
{ov::element::u8,
{{}, {}, {}},
ov::element::u8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,21 @@ class MoveFakeQuantizeTransformation : public LayerTransformation,
ov::IntervalsAlignmentSharedValue::Interval interval{-1.28f, 2.55f};

actualFunction = ov::builder::subgraph::MoveFakeQuantize::get(precision,
inputShapes,
testValues.actual.number_of_operations,
testValues.actual.fakeQuantizeBefore,
testValues.actual.convertBefore,
testValues.actual.dequantizationBefore,
testValues.actual.operation,
testValues.actual.fakeQuantizeAfter,
testValues.actual.convertAfter,
testValues.actual.dequantizationAfter,
{ov::PrecisionPreservedAttribute(true),
ov::IntervalsAlignmentAttribute(interval, 256),
ov::QuantizationAlignmentAttribute(false)},
ov::element::dynamic,
testValues.axis,
oneInputWithSplit);
inputShapes,
testValues.actual.number_of_operations,
testValues.actual.fakeQuantizeBefore,
testValues.actual.convertBefore,
testValues.actual.dequantizationBefore,
testValues.actual.operation,
testValues.actual.fakeQuantizeAfter,
testValues.actual.convertAfter,
testValues.actual.dequantizationAfter,
{ov::PrecisionPreservedAttribute(true),
ov::IntervalsAlignmentAttribute(interval, 256),
ov::QuantizationAlignmentAttribute(false)},
ov::element::dynamic,
testValues.axis,
oneInputWithSplit);

auto supportedPrecisionsOnActivation = std::vector<ov::pass::low_precision::PrecisionsRestriction>(
{ov::pass::low_precision::PrecisionsRestriction::create<ov::op::v1::AvgPool>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,26 +277,81 @@ std::vector<ov::op::PadMode> modesInWhichSubPropagated = {
};

const std::vector<PadTransformationTestValues> deqWithSub = {
{LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {128.f}, {3.f}}},
{ov::element::u8, {{}, {}, {}}, ov::element::u8, {{ov::element::f32}, {128.f}, {3.f}}}},
{LayerTransformation::createParamsI8I8(),
{ov::element::i8, {{ov::element::f32}, {64.f}, {3.f}}},
{ov::element::i8, {{}, {}, {}}, ov::element::i8, {{ov::element::f32}, {64.f}, {3.f}}}},
{LayerTransformation::createParamsI8I8(),
{ov::element::i8, {{ov::element::f32}, {{64.f, 32.f, 16.f}}, {{3.f, 1.f, 2.f}}}},
{ov::element::i8, {{}, {}, {}}, ov::element::i8, {{ov::element::f32}, {{64.f, 32.f, 16.f}}, {{3.f, 1.f, 2.f}}}}},
{LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {{128.f, 64.f, 32.f}}, {{3.f, 1.f, 2.f}}}},
{ov::element::u8, {{}, {}, {}}, ov::element::u8, {{ov::element::f32}, {{128.f, 64.f, 32.f}}, {{3.f, 1.f, 2.f}}}}},
{
LayerTransformation::createParamsU8I8(),
{
ov::element::u8,
{{ov::element::f32}, {128.f}, {3.f}}
},
{
ov::element::u8,
{{}, {}, {}},
ov::element::u8,
{{ov::element::f32}, {128.f}, {3.f}}
}
},
{
LayerTransformation::createParamsI8I8(),
{
ov::element::i8,
{{ov::element::f32}, {64.f}, {3.f}}
},
{
ov::element::i8,
{{}, {}, {}},
ov::element::i8,
{{ov::element::f32}, {64.f}, {3.f}}
}
},
{
LayerTransformation::createParamsI8I8(),
{
ov::element::i8,
{{ov::element::f32}, {{64.f, 32.f, 16.f}}, {{3.f, 1.f, 2.f}}}
},
{
ov::element::i8,
{{}, {}, {}},
ov::element::i8,
{{ov::element::f32}, {{64.f, 32.f, 16.f}}, {{3.f, 1.f, 2.f}}}
}
},
{
LayerTransformation::createParamsU8I8(),
{
ov::element::u8,
{{ov::element::f32}, {{128.f, 64.f, 32.f}}, {{3.f, 1.f, 2.f}}}
},
{
ov::element::u8,
{{}, {}, {}},
ov::element::u8,
{{ov::element::f32}, {{128.f, 64.f, 32.f}}, {{3.f, 1.f, 2.f}}}
}
},
// int8 subtraction with Convert from u8 to fp32
{LayerTransformation::createParamsU8I8(),
{ov::element::u8,
{{ov::element::f32}, {{128.f}, element::dynamic, {1, 3, 1, 1}, false, 1ul, element::u8, true}, {3.f}}},
{ov::element::u8,
{{}, {}, {}},
ov::element::u8,
{{ov::element::f32}, {{128.f}, element::dynamic, {1, 3, 1, 1}, false, 1ul, element::u8, true}, {3.f}}}}};
{
LayerTransformation::createParamsU8I8(),
{
ov::element::u8,
{
{ov::element::f32},
{{128.f}, element::dynamic, {1, 3, 1, 1}, false, 1ul, element::u8, true},
{3.f}
}
},
{
ov::element::u8,
{{}, {}, {}},
ov::element::u8,
{
{ov::element::f32},
{{128.f}, element::dynamic, {1, 3, 1, 1}, false, 1ul, element::u8, true},
{3.f}
}
}
}
};

INSTANTIATE_TEST_SUITE_P(
smoke_LPT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ TEST_P(ReshapeTransformation, CompareFunctions) {

ASSERT_TRUE(LayerTransformation::allNamesAreUnique(actualFunction)) << "Not all names are unique";
}

OPENVINO_SUPPRESS_DEPRECATED_START
const std::vector<ReshapeTransformationTestValues> testValues = {
// U8: no subtract 3D -> 4D: channels are not affected
{{1, 384, 1024},
Expand Down Expand Up @@ -221,8 +221,12 @@ const std::vector<ReshapeTransformationTestValues> testValues = {
{{100, 4, 1, 1},
{-1, 1, 400},
LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {}, {{0.1f, 0.1f, 0.1f, 0.1f}, ov::element::f32, {1, 4, 1, 1}}}},
{ov::element::u8, {{}, {}, {}}, ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
{ov::element::u8,
{{ov::element::f32}, {}, {{0.1f, 0.1f, 0.1f, 0.1f}, ov::element::f32, {1, 4, 1, 1}}}},
{ov::element::u8,
{{}, {}, {}},
ov::element::u8,
{{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
// U8: no subtract 4D -> 6D: channels are not affected: no subtract
{{1, 3, 4, 5},
{1, 3, 20, 1, 1, 1},
Expand Down Expand Up @@ -346,7 +350,8 @@ const std::vector<ReshapeTransformationTestValues> testValues = {
{{1, 3, 4, 5},
{0, -1},
LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {{128.f}, ov::element::f32, {}}, {{0.1f}, ov::element::f32, {}}}},
{ov::element::u8,
{{ov::element::f32}, {{128.f}, ov::element::f32, {}}, {{0.1f}, ov::element::f32, {}}}},
{ov::element::u8,
{},
ov::element::u8,
Expand Down Expand Up @@ -480,42 +485,61 @@ const std::vector<ReshapeTransformationTestValues> testValues = {
{1, -1},
LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}},
{ov::element::u8, {{}, {}, {}}, ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
{ov::element::u8,
{{}, {}, {}},
ov::element::u8,
{{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
// U8: no subtract 4D -> 2D
{{2, 2048, 1, 1},
{2, -1},
LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {1ul}}}},
{ov::element::u8, {{}, {}, {}}, ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
{ov::element::u8,
{{}, {}, {}},
ov::element::u8,
{{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
// U8: no subtract 4D -> 2D
{{1, 2048, 1, 1},
{1, -1},
LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {1, 1, 1, 1}}}},
{ov::element::u8, {{}, {}, {}}, ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
{ov::element::u8,
{{}, {}, {}},
ov::element::u8,
{{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
// U8: no subtract 4D -> 2D: channels are not affected
{{2, 2048, 1, 1},
{2, -1},
LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {1, 1, 1, 1}}}},
{ov::element::u8, {{}, {}, {}}, ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
{ov::element::u8,
{{}, {}, {}},
ov::element::u8,
{{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
// U8: no subtract 4D -> 2D: channels are not affected, dynamic batch
{{-1, 2048, 1, 1},
{0, -1},
LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {1, 1, 1, 1}}}},
{ov::element::u8, {{}, {}, {}}, ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
{ov::element::u8,
{{}, {}, {}},
ov::element::u8,
{{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
// U8: no subtract 4D -> 4D: channels are affected
{{1, 64, 320, 1},
{0, 2, 3, 1},
LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}},
{ov::element::u8, {{}, {}, {}}, ov::element::u8, {{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
{ov::element::u8,
{{}, {}, {}},
ov::element::u8,
{{ov::element::f32}, {}, {{0.1f}, ov::element::f32, {}}}}},
// U8: with subtract 4D -> 4D: channels are affected
{{1, 64, 320, 1},
{0, 2, 3, 1},
LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {{128.f}, ov::element::f32, {}}, {{0.1f}, ov::element::f32, {}}}},
{ov::element::u8,
{{ov::element::f32}, {{128.f}, ov::element::f32, {}}, {{0.1f}, ov::element::f32, {}}}},
{ov::element::u8,
{{}, {}, {}},
ov::element::u8,
Expand Down Expand Up @@ -587,8 +611,12 @@ const std::vector<ReshapeTransformationTestValues> testValues = {
{},
LayerTransformation::createParamsU8I8(),
{ov::element::u8, {{ov::element::f32}, {{128.f, 124.f, 120.f}}, {{0.1f, 1.f, 10.f}}}},
{ov::element::u8, {{ov::element::f32}, {{128.f, 124.f, 120.f}}, {{0.1f, 1.f, 10.f}}}, ov::element::f32, {}}},
{ov::element::u8,
{{ov::element::f32}, {{128.f, 124.f, 120.f}}, {{0.1f, 1.f, 10.f}}},
ov::element::f32,
{}}},
};
OPENVINO_SUPPRESS_DEPRECATED_END

INSTANTIATE_TEST_SUITE_P(smoke_LPT,
ReshapeTransformation,
Expand Down
Loading

0 comments on commit a5aa6f1

Please sign in to comment.