src/common/*transformations/
API1.0 clean up (#21574)
* `src/common/transformations/` API1.0 cleanup * `src/common/low_precision_transformations/` API1.0 cleanup * Fix comments * Fix
This commit is contained in:
parent
34b2b66b69
commit
ef14b50d79
@ -28,7 +28,6 @@ ov_build_target_faster(${TARGET_NAME}_obj UNITY)
|
||||
target_link_libraries(${TARGET_NAME}_obj PRIVATE openvino::itt)
|
||||
|
||||
target_include_directories(${TARGET_NAME}_obj PRIVATE $<BUILD_INTERFACE:${PUBLIC_HEADERS_DIR}>
|
||||
$<BUILD_INTERFACE:$<TARGET_PROPERTY:ngraph,INTERFACE_INCLUDE_DIRECTORIES>>
|
||||
$<BUILD_INTERFACE:$<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>>)
|
||||
|
||||
add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}_obj)
|
||||
@ -46,7 +45,6 @@ target_link_libraries(${TARGET_NAME} INTERFACE openvino::runtime)
|
||||
|
||||
target_include_directories(${TARGET_NAME} INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:$<TARGET_PROPERTY:ngraph,INTERFACE_INCLUDE_DIRECTORIES>>
|
||||
$<BUILD_INTERFACE:$<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>>)
|
||||
|
||||
# LTO
|
||||
|
@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <ngraph/ngraph.hpp>
|
||||
#include "openvino/pass/pattern/matcher.hpp"
|
||||
#include "low_precision/layer_transformation.hpp"
|
||||
|
||||
namespace ov {
|
||||
@ -25,7 +25,7 @@ public:
|
||||
OPENVINO_RTTI("BatchToSpaceTransformation", "0");
|
||||
BatchToSpaceTransformation(const Params& params = Params());
|
||||
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> op) const override;
|
||||
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
|
||||
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
|
||||
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
|
||||
};
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ngraph/visibility.hpp"
|
||||
#include "openvino/core/visibility.hpp"
|
||||
|
||||
/**
|
||||
* @file lpt_visibility.hpp
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ngraph/ngraph.hpp>
|
||||
#include "openvino/pass/pattern/matcher.hpp"
|
||||
#include "low_precision/eltwise_base_transformation.hpp"
|
||||
|
||||
namespace ov {
|
||||
@ -23,7 +23,7 @@ class LP_TRANSFORMATIONS_API MultiplyPartialTransformation : public EltwiseBaseT
|
||||
public:
|
||||
OPENVINO_RTTI("MultiplyPartialTransformation", "0");
|
||||
MultiplyPartialTransformation(const Params& params = Params());
|
||||
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
|
||||
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
|
||||
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> layer) const override;
|
||||
};
|
||||
|
||||
|
@ -126,8 +126,8 @@ public:
|
||||
std::shared_ptr<ov::Node> input = nullptr);
|
||||
|
||||
static std::shared_ptr<ov::Node> makeDequantizationSubtract(
|
||||
const ngraph::Output<ov::Node>& parent,
|
||||
const ngraph::Output<ov::Node>& subtract_constant);
|
||||
const ov::Output<ov::Node>& parent,
|
||||
const ov::Output<ov::Node>& subtract_constant);
|
||||
|
||||
static bool areQuantizeAndDequantizeSupportedForSubtract(const std::shared_ptr<const ov::Node>& node,
|
||||
const std::vector<ov::element::Type>& defaultPrecisions = precision_set::get_int8_support());
|
||||
|
@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <ngraph/ngraph.hpp>
|
||||
#include "openvino/pass/pattern/matcher.hpp"
|
||||
#include "low_precision/layer_transformation.hpp"
|
||||
|
||||
namespace ov {
|
||||
@ -25,7 +25,7 @@ public:
|
||||
OPENVINO_RTTI("SpaceToBatchTransformation", "0");
|
||||
SpaceToBatchTransformation(const Params& params = Params());
|
||||
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> op) const override;
|
||||
bool transform(TransformationContext& context, ngraph::pattern::Matcher &m) override;
|
||||
bool transform(TransformationContext& context, ov::pass::pattern::Matcher &m) override;
|
||||
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override;
|
||||
};
|
||||
|
||||
|
@ -111,9 +111,9 @@ bool MultiplyToGroupConvolutionTransformation::transform(TransformationContext&
|
||||
const auto weightsNode = std::make_shared<ov::opset1::Constant>(weightsPrecision, weightsShape, weightsBuffer);
|
||||
|
||||
const size_t spatialDimsSize = pShape.rank().get_length() - 2;
|
||||
ngraph::Strides strides(spatialDimsSize, 1ul);
|
||||
ngraph::CoordinateDiff pads(spatialDimsSize, 0ul);
|
||||
ngraph::Strides dilations(spatialDimsSize, 1ul);
|
||||
ov::Strides strides(spatialDimsSize, 1ul);
|
||||
ov::CoordinateDiff pads(spatialDimsSize, 0ul);
|
||||
ov::Strides dilations(spatialDimsSize, 1ul);
|
||||
|
||||
const auto convolution = std::make_shared<ov::op::TypeRelaxed<ov::opset1::GroupConvolution>>(
|
||||
std::vector<element::Type>{ element::f32, element::f32 },
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include <transformations/utils/utils.hpp>
|
||||
#include <transformations/init_node_info.hpp>
|
||||
#include <ngraph/opsets/opset2.hpp>
|
||||
#include <low_precision/batch_to_space.hpp>
|
||||
|
||||
#include "common_test_utils/ov_test_utils.hpp"
|
||||
@ -51,14 +50,14 @@ public:
|
||||
};
|
||||
|
||||
typedef std::tuple<
|
||||
ngraph::PartialShape,
|
||||
ov::PartialShape,
|
||||
BatchToSpaceTransformationTestValues> BatchToSpaceTransformationParams;
|
||||
|
||||
class BatchToSpaceTransformation : public LayerTransformation,
|
||||
public testing::WithParamInterface<BatchToSpaceTransformationParams> {
|
||||
public:
|
||||
void SetUp() override {
|
||||
const ngraph::PartialShape input_shape = std::get<0>(GetParam());
|
||||
const ov::PartialShape input_shape = std::get<0>(GetParam());
|
||||
const BatchToSpaceTransformationTestValues test_values = std::get<1>(GetParam());
|
||||
|
||||
actualFunction = ngraph::builder::subgraph::BatchToSpaceFunction::get(
|
||||
@ -85,7 +84,7 @@ public:
|
||||
}
|
||||
|
||||
static std::string getTestCaseName(testing::TestParamInfo<BatchToSpaceTransformationParams> obj) {
|
||||
const ngraph::PartialShape shape = std::get<0>(obj.param);
|
||||
const ov::PartialShape shape = std::get<0>(obj.param);
|
||||
const BatchToSpaceTransformationTestValues testValues = std::get<1>(obj.param);
|
||||
|
||||
std::ostringstream result;
|
||||
@ -109,7 +108,7 @@ TEST_P(BatchToSpaceTransformation, CompareFunctions) {
|
||||
}
|
||||
|
||||
namespace testValues {
|
||||
const std::vector<ngraph::PartialShape> input_shapes = {
|
||||
const std::vector<ov::PartialShape> input_shapes = {
|
||||
{4, 3, 50, 86}
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnActivations;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnWeights;
|
||||
ngraph::builder::subgraph::Constant weights;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ov::element::Type precisionAfterOperation;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter;
|
||||
};
|
||||
|
@ -38,8 +38,8 @@ public:
|
||||
public:
|
||||
ov::element::Type precisionBeforeDequantization;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnActivations;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph:: builder::subgraph::DequantizationOperations dequantizationOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnWeights;
|
||||
std::shared_ptr<ov::op::v0::Constant> weights;
|
||||
callback_function_type callback;
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
public:
|
||||
ov::element::Type precisionBeforeDequantization;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnActivations;
|
||||
ngraph:: builder::subgraph::DequantizationOperations dequantizationOnWeights;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnWeights;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter;
|
||||
std::shared_ptr<ov::op::v0::Constant> weights;
|
||||
bool transformed;
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnActivations;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnWeights;
|
||||
ngraph::builder::subgraph::Constant weights;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ov::element::Type precisionAfterOperation;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter;
|
||||
};
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
ov::element::Type precisionBeforeDequantization;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnActivations;
|
||||
std::shared_ptr<ov::op::v0::Constant> weights;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
};
|
||||
|
||||
class Expected {
|
||||
@ -37,7 +37,7 @@ public:
|
||||
ov::element::Type precisionBeforeDequantization;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationBefore;
|
||||
std::shared_ptr<ov::op::v0::Constant> weights;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ov::element::Type precisionAfterOperation;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter;
|
||||
ov::element::Type precisionAfterDequantization;
|
||||
|
@ -28,13 +28,13 @@ public:
|
||||
class Actual {
|
||||
public:
|
||||
std::shared_ptr<ov::op::v0::Constant> weights;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
};
|
||||
|
||||
class Expected {
|
||||
public:
|
||||
std::shared_ptr<ov::op::v0::Constant> weights;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
};
|
||||
|
||||
TestTransformationParams params;
|
||||
|
@ -26,15 +26,15 @@ using namespace ov::pass;
|
||||
namespace {
|
||||
class ActualValues {
|
||||
public:
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnData fakeQuantizeOnData;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantizeOnData;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
};
|
||||
|
||||
class ExpectedValues {
|
||||
public:
|
||||
element::Type fakeQuantizeOnDataOutPrecision;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnData fakeQuantizeOnData;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantizeOnData;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
};
|
||||
|
||||
class FakeQuantizePrecisionSelectionTransformationTestValues {
|
||||
|
@ -42,8 +42,8 @@ public:
|
||||
addNotPrecisionPreservedOperation(addNotPrecisionPreservedOperation) {}
|
||||
|
||||
TestTransformationParams params;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnDataWithConstant actual;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnDataWithConstant expected;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant actual;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant expected;
|
||||
ov::element::Type expectedFakeQuantizeOnDataPrecision;
|
||||
std::map<ov::element::Type, ngraph::builder::subgraph::DequantizationOperations> expectedValues;
|
||||
// add not precision preserved operation to set output precision for FakeQuantize
|
||||
|
@ -31,13 +31,13 @@ class FakeQuantizeWithNotOptimalTransformationTestValues {
|
||||
public:
|
||||
class Values {
|
||||
public:
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnDataWithConstant fqOnData;
|
||||
ngraph:: builder::subgraph::DequantizationOperations::Convert convertOnData;
|
||||
ngraph:: builder::subgraph::DequantizationOperations dequantizationOnData;
|
||||
ngraph:: builder::subgraph::Constant constantOnWeights;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fqOnWeights;
|
||||
ngraph:: builder::subgraph::DequantizationOperations dequantizationOnWeights;
|
||||
ngraph:: builder::subgraph::DequantizationOperations dequantizationAfter;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fqOnData;
|
||||
ngraph::builder::subgraph::DequantizationOperations::Convert convertOnData;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnData;
|
||||
ngraph::builder::subgraph::Constant constantOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fqOnWeights;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnWeights;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter;
|
||||
};
|
||||
TestTransformationParams params;
|
||||
Values actual;
|
||||
|
@ -117,9 +117,9 @@ private:
|
||||
auto fakeQuantize = std::make_shared<ov::op::v0::FakeQuantize>(input, inputLow, inputHigh, outputLow, outputHigh, levels);
|
||||
fakeQuantize->set_friendly_name("fakeQuantize");
|
||||
|
||||
ngraph::ResultVector results{ std::make_shared<ov::op::v0::Result>(fakeQuantize) };
|
||||
ov::ResultVector results{ std::make_shared<ov::op::v0::Result>(fakeQuantize) };
|
||||
|
||||
ngraph::ParameterVector inputs{ input };
|
||||
ov::ParameterVector inputs{ input };
|
||||
if (as_type_ptr<ov::op::v0::Parameter>(inputLow)) {
|
||||
inputs.push_back(as_type_ptr<ov::op::v0::Parameter>(inputLow));
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ public:
|
||||
output->set_friendly_name("output");
|
||||
|
||||
return std::make_shared<ov::Model>(
|
||||
ngraph::ResultVector{ std::make_shared<ov::op::v0::Result>(output) },
|
||||
ngraph::ParameterVector{ input },
|
||||
ov::ResultVector{ std::make_shared<ov::op::v0::Result>(output) },
|
||||
ov::ParameterVector{ input },
|
||||
"FoldConvertTransformation");
|
||||
};
|
||||
actualFunction = createFunction(testValues.precision, inputShape, testValues.dequantizationActual);
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
public:
|
||||
std::vector<float> constValues;
|
||||
ov::element::Type constPrecision;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnData fakeQuantize;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize;
|
||||
ov::element::Type fqOutPrecision;
|
||||
};
|
||||
|
||||
@ -90,10 +90,10 @@ public:
|
||||
testValues.actual.fqOutPrecision);
|
||||
fq = ov::pass::low_precision::NetworkHelper::fold_fake_quantize(as_type_ptr<ov::op::v0::FakeQuantize>(fq),
|
||||
testValues.roundValues);
|
||||
ngraph::ResultVector results{std::make_shared<ov::op::v0::Result>(fq)};
|
||||
ov::ResultVector results{std::make_shared<ov::op::v0::Result>(fq)};
|
||||
actualFunction = std::make_shared<ov::Model>(
|
||||
results,
|
||||
parameter ? ngraph::ParameterVector{parameter} : ngraph::ParameterVector{},
|
||||
parameter ? ov::ParameterVector{parameter} : ov::ParameterVector{},
|
||||
"FoldFakeQuantizeFunction");
|
||||
|
||||
referenceFunction =
|
||||
|
@ -24,8 +24,8 @@ using namespace ov::pass;
|
||||
|
||||
class GetDequantizationBelowTestValues {
|
||||
public:
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnData fakeQuantize;
|
||||
ngraph:: builder::subgraph::DequantizationOperations dequantization;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantization;
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, const std::vector<float>& values) {
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
ov::element::Type precisionBeforeDequantization;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantization;
|
||||
std::shared_ptr<ov::op::v0::Constant> weights;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnWeights;
|
||||
};
|
||||
|
||||
@ -38,7 +38,7 @@ public:
|
||||
ov::element::Type precisionBeforeDequantization;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationBefore;
|
||||
std::shared_ptr<ov::op::v0::Constant> weights;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnWeights;
|
||||
ov::element::Type precisionAfterOperation;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter;
|
||||
|
@ -27,7 +27,7 @@ using namespace ngraph::builder::subgraph;
|
||||
|
||||
class interpAttributes {
|
||||
public:
|
||||
ngraph::AxisSet axes;
|
||||
ov::AxisSet axes;
|
||||
std::string mode;
|
||||
bool align_corners;
|
||||
bool antialias;
|
||||
@ -36,7 +36,7 @@ public:
|
||||
|
||||
interpAttributes() = default;
|
||||
|
||||
interpAttributes(const ngraph::AxisSet& axes,
|
||||
interpAttributes(const ov::AxisSet& axes,
|
||||
const std::string& mode,
|
||||
const bool& align_corners,
|
||||
const bool& antialias,
|
||||
@ -206,7 +206,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
|
||||
ov::Shape{},
|
||||
LayerTransformation::createParamsU8I8(),
|
||||
interpAttributes(
|
||||
ngraph::AxisSet{2, 3},
|
||||
ov::AxisSet{2, 3},
|
||||
"nearest",
|
||||
false,
|
||||
false,
|
||||
@ -233,7 +233,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
|
||||
ov::Shape{},
|
||||
LayerTransformation::createParamsU8I8(),
|
||||
interpAttributes(
|
||||
ngraph::AxisSet{2, 3},
|
||||
ov::AxisSet{2, 3},
|
||||
"nearest",
|
||||
false,
|
||||
false,
|
||||
@ -260,7 +260,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
|
||||
ov::Shape{},
|
||||
LayerTransformation::createParamsU8I8(),
|
||||
interpAttributes(
|
||||
ngraph::AxisSet{2, 3},
|
||||
ov::AxisSet{2, 3},
|
||||
"nearest",
|
||||
false,
|
||||
false,
|
||||
@ -287,7 +287,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
|
||||
ov::Shape{},
|
||||
LayerTransformation::createParamsU8I8(),
|
||||
interpAttributes(
|
||||
ngraph::AxisSet{2, 3},
|
||||
ov::AxisSet{2, 3},
|
||||
"nearest",
|
||||
false,
|
||||
false,
|
||||
@ -314,7 +314,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
|
||||
ov::Shape{},
|
||||
LayerTransformation::createParamsU8I8(),
|
||||
interpAttributes(
|
||||
ngraph::AxisSet{2, 3},
|
||||
ov::AxisSet{2, 3},
|
||||
"linear",
|
||||
false,
|
||||
false,
|
||||
@ -341,7 +341,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
|
||||
ov::Shape{},
|
||||
LayerTransformation::createParamsU8I8(),
|
||||
interpAttributes(
|
||||
ngraph::AxisSet{1, 2, 3},
|
||||
ov::AxisSet{1, 2, 3},
|
||||
"nearest",
|
||||
false,
|
||||
false,
|
||||
@ -368,7 +368,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
|
||||
ov::Shape{},
|
||||
LayerTransformation::createParamsU8I8(),
|
||||
interpAttributes(
|
||||
ngraph::AxisSet{2, 3},
|
||||
ov::AxisSet{2, 3},
|
||||
"nearest",
|
||||
true,
|
||||
false,
|
||||
@ -395,7 +395,7 @@ const std::vector<InterpolateTransformationTestValues> testValues {
|
||||
ov::Shape{},
|
||||
LayerTransformation::createParamsU8I8(),
|
||||
interpAttributes(
|
||||
ngraph::AxisSet{2, 3},
|
||||
ov::AxisSet{2, 3},
|
||||
"nearest",
|
||||
false,
|
||||
false,
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
ov::element::Type precisionBeforeDequantization;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnActivations;
|
||||
std::shared_ptr<ov::op::v0::Constant> weights;
|
||||
ngraph:: builder::subgraph::DequantizationOperations dequantizationOnWeights;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnWeights;
|
||||
bool isAsymmetricOnWeights;
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
ov::element::Type precisionBeforeDequantization;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationOnActivations;
|
||||
std::shared_ptr<ov::op::v0::Constant> weights;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights;
|
||||
};
|
||||
|
||||
typedef std::tuple<
|
||||
|
@ -112,10 +112,10 @@ TEST(LPT, isConstantPathConvParentDqTransformation) {
|
||||
const auto conv = std::make_shared<ov::opset1::Convolution>(
|
||||
input,
|
||||
weights,
|
||||
ngraph::Strides{ 1, 1 },
|
||||
ngraph::CoordinateDiff{ 0, 0 },
|
||||
ngraph::CoordinateDiff{ 0, 0 },
|
||||
ngraph::Strides{ 1, 1 });
|
||||
ov::Strides{ 1, 1 },
|
||||
ov::CoordinateDiff{ 0, 0 },
|
||||
ov::CoordinateDiff{ 0, 0 },
|
||||
ov::Strides{ 1, 1 });
|
||||
const auto dqAfterConv = makeDequantization(conv, DequantizationOperations{ {}, {}, {0.1f} });
|
||||
|
||||
const bool result = ov::pass::low_precision::NetworkHelper::isConstantPath(dqAfterConv);
|
||||
@ -129,10 +129,10 @@ TEST(LPT, isConstantPathGroupConvParentDqTransformation) {
|
||||
const auto groupConv = std::make_shared<ov::opset1::GroupConvolution>(
|
||||
input,
|
||||
weights,
|
||||
ngraph::Strides{ 1, 1 },
|
||||
ngraph::CoordinateDiff{ 0, 0 },
|
||||
ngraph::CoordinateDiff{ 0, 0 },
|
||||
ngraph::Strides{ 1, 1 });
|
||||
ov::Strides{ 1, 1 },
|
||||
ov::CoordinateDiff{ 0, 0 },
|
||||
ov::CoordinateDiff{ 0, 0 },
|
||||
ov::Strides{ 1, 1 });
|
||||
const auto dqAfterGroupConv = makeDequantization(groupConv, DequantizationOperations{ {}, {}, {0.1f} });
|
||||
|
||||
const bool result = ov::pass::low_precision::NetworkHelper::isConstantPath(dqAfterGroupConv);
|
||||
|
@ -21,7 +21,7 @@ class IsFunctionQuantizedTransformationValues {
|
||||
public:
|
||||
ov::Shape shape;
|
||||
ov::element::Type precision;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantize;
|
||||
bool constantSubgraphOnParameters;
|
||||
bool inputOnParameters;
|
||||
|
||||
@ -44,8 +44,8 @@ public:
|
||||
replace_node(fakeQuantize->get_input_node_shared_ptr(3), input);
|
||||
}
|
||||
|
||||
ngraph::ResultVector results{ std::make_shared<ov::op::v0::Result>(fakeQuantize) };
|
||||
model = std::make_shared<ov::Model>(results, ngraph::ParameterVector{ input }, "IsFunctionQuantizedFunction");
|
||||
ov::ResultVector results{ std::make_shared<ov::op::v0::Result>(fakeQuantize) };
|
||||
model = std::make_shared<ov::Model>(results, ov::ParameterVector{ input }, "IsFunctionQuantizedFunction");
|
||||
model->validate_nodes_and_infer_types();
|
||||
}
|
||||
|
||||
|
@ -150,10 +150,10 @@ TEST(LPT, AvoidDequantizationToShapeOfPropagationConvolutionTransformation) {
|
||||
|
||||
auto convolution = std::make_shared<ov::op::v1::Convolution>(mul,
|
||||
mulOnWeights,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::Strides{1, 1});
|
||||
ov::Strides{1, 1},
|
||||
ov::CoordinateDiff{0, 0},
|
||||
ov::CoordinateDiff{0, 0},
|
||||
ov::Strides{1, 1});
|
||||
|
||||
auto shapeOf = std::make_shared<ov::op::v0::ShapeOf>(convolution);
|
||||
|
||||
@ -180,10 +180,10 @@ TEST(LPT, AvoidDequantizationToShapeOfPropagationConvolutionBackpropDataTransfor
|
||||
|
||||
auto convolutionBackpropData = std::make_shared<ov::op::v1::ConvolutionBackpropData>(mul,
|
||||
mulOnWeights,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::Strides{1, 1});
|
||||
ov::Strides{1, 1},
|
||||
ov::CoordinateDiff{0, 0},
|
||||
ov::CoordinateDiff{0, 0},
|
||||
ov::Strides{1, 1});
|
||||
|
||||
auto shapeOf = std::make_shared<ov::op::v0::ShapeOf>(convolutionBackpropData);
|
||||
|
||||
@ -255,10 +255,10 @@ TEST(LPT, AvoidDequantizationToShapeOfPropagationGroupConvolutionTransformation)
|
||||
|
||||
auto groupConvolution = std::make_shared<ov::op::v1::GroupConvolution>(mul,
|
||||
reshapeOnWeights,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::Strides{1, 1});
|
||||
ov::Strides{1, 1},
|
||||
ov::CoordinateDiff{0, 0},
|
||||
ov::CoordinateDiff{0, 0},
|
||||
ov::Strides{1, 1});
|
||||
auto shapeOf = std::make_shared<ov::op::v0::ShapeOf>(groupConvolution);
|
||||
|
||||
auto result1 = std::make_shared<ov::op::v0::Result>(groupConvolution);
|
||||
@ -646,9 +646,9 @@ TEST(LPT, AvoidDequantizationToShapeOfPropagationStridedSliceTransformation) {
|
||||
auto convert = std::make_shared<ov::op::v0::Convert>(input, element::f32);
|
||||
auto mul = std::make_shared<ov::op::v1::Multiply>(convert, ov::op::v0::Constant::create(element::f32, {}, {2.f}));
|
||||
|
||||
auto beginParam = ngraph::op::v0::Constant::create(ov::element::i64, ov::Shape{4}, {0, 0, 0, 0});
|
||||
auto endParam = ngraph::op::v0::Constant::create(ov::element::i64, ov::Shape{4}, {1, 2, 1, 1});
|
||||
auto stridesParam = ngraph::op::v0::Constant::create(ov::element::i64, ov::Shape{4}, {1, 1, 1, 1});
|
||||
auto beginParam = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{4}, {0, 0, 0, 0});
|
||||
auto endParam = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{4}, {1, 2, 1, 1});
|
||||
auto stridesParam = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{4}, {1, 1, 1, 1});
|
||||
auto stridedSlice = std::make_shared<ov::op::v1::StridedSlice>(mul,
|
||||
beginParam,
|
||||
endParam,
|
||||
@ -674,7 +674,7 @@ TEST(LPT, AvoidDequantizationToShapeOfPropagationTransposeTransformation) {
|
||||
auto convert = std::make_shared<ov::op::v0::Convert>(input, element::f32);
|
||||
auto mul = std::make_shared<ov::op::v1::Multiply>(convert, ov::op::v0::Constant::create(element::f32, {}, {2.f}));
|
||||
|
||||
auto constant = ngraph::op::v0::Constant::create(ov::element::i64, ov::Shape{4}, {0, 1, 3, 2});
|
||||
auto constant = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{4}, {0, 1, 3, 2});
|
||||
auto transpose = std::make_shared<ov::op::v1::Transpose>(mul, constant);
|
||||
auto shapeOf = std::make_shared<ov::op::v0::ShapeOf>(transpose);
|
||||
|
||||
|
@ -28,7 +28,7 @@ using namespace ngraph::builder::subgraph;
|
||||
class MultiplyBranch {
|
||||
public:
|
||||
ngraph::builder::subgraph::Constant constant;
|
||||
ngraph::element::Type input_precision;
|
||||
ov::element::Type input_precision;
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantization;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fake_quantize;
|
||||
};
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
ngraph::builder::subgraph::DequantizationOperations dequantizationAfter;
|
||||
};
|
||||
|
||||
ngraph::AxisSet reductionAxes;
|
||||
ov::AxisSet reductionAxes;
|
||||
bool normalizeVariance;
|
||||
TestTransformationParams params;
|
||||
Actual actual;
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
typedef std::tuple<
|
||||
ov::element::Type,
|
||||
ov::PartialShape,
|
||||
ngraph::op::EpsMode,
|
||||
ov::op::EpsMode,
|
||||
std::vector<size_t>,
|
||||
NormalizeL2TransformationTestValues> NormalizeL2TransformationParams;
|
||||
|
||||
@ -56,7 +56,7 @@ public:
|
||||
void SetUp() override {
|
||||
ov::element::Type precision;
|
||||
ov::PartialShape shape;
|
||||
ngraph::op::EpsMode epsMode;
|
||||
ov::op::EpsMode epsMode;
|
||||
std::vector<size_t> axes;
|
||||
NormalizeL2TransformationTestValues params;
|
||||
std::tie(precision, shape, epsMode, axes, params) = GetParam();
|
||||
@ -88,7 +88,7 @@ public:
|
||||
ov::element::Type precision;
|
||||
ov::PartialShape shape;
|
||||
ov::Shape axes;
|
||||
ngraph::op::EpsMode epsMode;
|
||||
ov::op::EpsMode epsMode;
|
||||
NormalizeL2TransformationTestValues params;
|
||||
std::tie(precision, shape, epsMode, axes, params) = obj.param;
|
||||
|
||||
@ -115,9 +115,9 @@ const std::vector<ov::element::Type> precisions = {
|
||||
ov::element::f16
|
||||
};
|
||||
|
||||
std::vector<ngraph::op::EpsMode> epsMode = {
|
||||
ngraph::op::EpsMode::ADD,
|
||||
ngraph::op::EpsMode::MAX
|
||||
std::vector<ov::op::EpsMode> epsMode = {
|
||||
ov::op::EpsMode::ADD,
|
||||
ov::op::EpsMode::MAX
|
||||
};
|
||||
|
||||
std::vector<std::vector<size_t>> axes = {
|
||||
|
@ -72,11 +72,11 @@ public:
|
||||
reshape2->set_friendly_name("reshape2");
|
||||
|
||||
return std::make_shared<ov::Model>(
|
||||
ngraph::ResultVector{
|
||||
ov::ResultVector{
|
||||
std::make_shared<ov::op::v0::Result>(reshape1),
|
||||
std::make_shared<ov::op::v0::Result>(reshape2)
|
||||
},
|
||||
std::vector<std::shared_ptr<ngraph::op::Parameter>> { input },
|
||||
std::vector<std::shared_ptr<ov::op::v0::Parameter>> { input },
|
||||
"SeparateInStandaloneBranchTransformation");
|
||||
};
|
||||
actualFunction = createActualFunction(testValues.precisionBefore, shape, testValues.dequantization);
|
||||
@ -103,11 +103,11 @@ public:
|
||||
reshape2->set_friendly_name("reshape2");
|
||||
|
||||
return std::make_shared<ov::Model>(
|
||||
ngraph::ResultVector{
|
||||
ov::ResultVector{
|
||||
std::make_shared<ov::op::v0::Result>(reshape1),
|
||||
std::make_shared<ov::op::v0::Result>(reshape2)
|
||||
},
|
||||
std::vector<std::shared_ptr<ngraph::op::Parameter>> { input },
|
||||
std::vector<std::shared_ptr<ov::op::v0::Parameter>> { input },
|
||||
"SeparateInStandaloneBranchTransformation");
|
||||
};
|
||||
referenceFunction = createReferenceFunction(testValues.precisionBefore, shape, testValues.dequantization);
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include <transformations/utils/utils.hpp>
|
||||
#include <transformations/init_node_info.hpp>
|
||||
#include <ngraph/opsets/opset2.hpp>
|
||||
#include <low_precision/space_to_batch.hpp>
|
||||
|
||||
#include "common_test_utils/ov_test_utils.hpp"
|
||||
@ -51,13 +50,13 @@ public:
|
||||
};
|
||||
|
||||
typedef std::tuple<
|
||||
ngraph::PartialShape,
|
||||
ov::PartialShape,
|
||||
SpaceToBatchTransformationTestValues> SpaceToBatchTransformationParams;
|
||||
|
||||
class SpaceToBatchTransformation : public LayerTransformation, public testing::WithParamInterface<SpaceToBatchTransformationParams> {
|
||||
public:
|
||||
void SetUp() override {
|
||||
const ngraph::PartialShape input_shape = std::get<0>(GetParam());
|
||||
const ov::PartialShape input_shape = std::get<0>(GetParam());
|
||||
const SpaceToBatchTransformationTestValues test_values = std::get<1>(GetParam());
|
||||
|
||||
actualFunction = ngraph::builder::subgraph::SpaceToBatchFunction::get(
|
||||
@ -84,7 +83,7 @@ public:
|
||||
}
|
||||
|
||||
static std::string getTestCaseName(testing::TestParamInfo<SpaceToBatchTransformationParams> obj) {
|
||||
const ngraph::PartialShape shape = std::get<0>(obj.param);
|
||||
const ov::PartialShape shape = std::get<0>(obj.param);
|
||||
const SpaceToBatchTransformationTestValues testValues = std::get<1>(obj.param);
|
||||
|
||||
std::ostringstream result;
|
||||
@ -108,7 +107,7 @@ TEST_P(SpaceToBatchTransformation, CompareFunctions) {
|
||||
}
|
||||
|
||||
namespace testValues {
|
||||
const std::vector<ngraph::PartialShape> shapes = {
|
||||
const std::vector<ov::PartialShape> shapes = {
|
||||
{1, 3, 100, 171},
|
||||
};
|
||||
|
||||
|
@ -27,8 +27,8 @@ namespace {
|
||||
|
||||
class TestValues {
|
||||
public:
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnData fqOnData;
|
||||
ngraph:: builder::subgraph::FakeQuantizeOnWeights fqOnWeights;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnData fqOnData;
|
||||
ngraph::builder::subgraph::FakeQuantizeOnWeights fqOnWeights;
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& out, const TestValues& testValue) {
|
||||
|
@ -43,8 +43,7 @@ endif()
|
||||
add_library(${TARGET_NAME} INTERFACE)
|
||||
|
||||
target_include_directories(${TARGET_NAME} INTERFACE
|
||||
$<BUILD_INTERFACE:${PUBLIC_HEADERS_DIR}>
|
||||
$<BUILD_INTERFACE:$<TARGET_PROPERTY:ngraph,INTERFACE_INCLUDE_DIRECTORIES>>)
|
||||
$<BUILD_INTERFACE:${PUBLIC_HEADERS_DIR}>)
|
||||
|
||||
target_link_libraries(${TARGET_NAME} INTERFACE openvino::runtime)
|
||||
|
||||
|
@ -12,12 +12,9 @@
|
||||
#include <string>
|
||||
|
||||
#include "common_test_utils/ov_test_utils.hpp"
|
||||
#include "common_test_utils/test_common.hpp"
|
||||
#include "ie_ngraph_utils.hpp"
|
||||
#include "openvino/core/model.hpp"
|
||||
#include "openvino/opsets/opset1.hpp"
|
||||
#include "transformations/rt_info/primitives_priority_attribute.hpp"
|
||||
#include "transformations/utils/utils.hpp"
|
||||
|
||||
using namespace ov;
|
||||
using namespace testing;
|
||||
|
Loading…
Reference in New Issue
Block a user