Rename ngraph with ov in common_test_utils (#17905)
* Rename ngraph with ov in common_test_utils * Fix comments * Delete opset includes from commonTestUtils * Fix CI and code style * Apply comments * Fix CI and apply comments
This commit is contained in:
1 parent
b7e14deddd
commit
48b47e754f
165 files changed
+2530
-2467
No files matched your search
@@ -33,7 +33,7 @@ TEST_F(TransformationTestsF, ClampFusion) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f32, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 2});
|
||||
auto clamp = std::make_shared<opset5::Clamp>(data, 0.1, 5);
|
||||
function_ref = std::make_shared<Function>(NodeVector{clamp}, ParameterVector{data});
|
||||
}
|
||||
@@ -52,7 +52,7 @@ TEST_F(TransformationTestsF, ClampFusionScalars) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f32, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 2});
|
||||
auto clamp = std::make_shared<opset5::Clamp>(data, 0.1, 5);
|
||||
function_ref = std::make_shared<Function>(NodeVector{clamp}, ParameterVector{data});
|
||||
}
|
||||
@@ -94,7 +94,7 @@ TEST_F(TransformationTestsF, ClampFusionMinMax) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f32, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 2});
|
||||
auto clamp = std::make_shared<opset5::Clamp>(data, 0.1, 5);
|
||||
function_ref = std::make_shared<Function>(NodeVector{clamp}, ParameterVector{data});
|
||||
}
|
||||
@@ -113,7 +113,7 @@ TEST_F(TransformationTestsF, ClampFusionMinMaxScalars) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f32, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 2});
|
||||
auto clamp = std::make_shared<opset5::Clamp>(data, 0.1, 5);
|
||||
function_ref = std::make_shared<Function>(NodeVector{clamp}, ParameterVector{data});
|
||||
}
|
||||
|
||||
+8
-8
@@ -147,25 +147,25 @@ TEST_F(TransformationTestsF, CompressConstants_f32_If) {
|
||||
default_scales_node,
|
||||
axes_node,
|
||||
interpolate4_attr);
|
||||
auto then_op_result = std::make_shared<ngraph::opset1::Result>(resize);
|
||||
auto then_op_result = std::make_shared<ov::op::v0::Result>(resize);
|
||||
auto body_then_function =
|
||||
std::make_shared<ov::Model>(ov::NodeVector{then_op_result}, ov::ParameterVector{input_then});
|
||||
|
||||
// create else body
|
||||
auto input_else = std::make_shared<ov::opset8::Parameter>(ov::element::f32, ov::Shape{1, 3, 12, 12});
|
||||
auto else_op_result = std::make_shared<ngraph::opset1::Result>(input_else);
|
||||
auto else_op_result = std::make_shared<ov::op::v0::Result>(input_else);
|
||||
auto body_else_function =
|
||||
std::make_shared<ov::Model>(ov::NodeVector{else_op_result}, ov::ParameterVector{input_else});
|
||||
|
||||
// create main graph
|
||||
auto input = std::make_shared<ov::opset8::Parameter>(ov::element::f32, ov::Shape{1, 3, 12, 12});
|
||||
auto cond = std::make_shared<ngraph::opset1::Constant>(ngraph::element::boolean, ngraph::Shape{1}, true);
|
||||
auto cond = std::make_shared<ov::op::v0::Constant>(ngraph::element::boolean, ngraph::Shape{1}, true);
|
||||
auto if_op = std::make_shared<ov::opset8::If>(cond);
|
||||
if_op->set_then_body(body_then_function);
|
||||
if_op->set_else_body(body_else_function);
|
||||
if_op->set_input(input, input_then, input_else);
|
||||
if_op->set_output(then_op_result, else_op_result);
|
||||
auto if_result = std::make_shared<ngraph::opset1::Result>(if_op);
|
||||
auto if_result = std::make_shared<ov::op::v0::Result>(if_op);
|
||||
|
||||
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{if_result}, ngraph::ParameterVector{input});
|
||||
|
||||
@@ -212,25 +212,25 @@ TEST_F(TransformationTestsF, CompressConstants_f32_If) {
|
||||
default_scales_node,
|
||||
axes_node,
|
||||
interpolate4_attr);
|
||||
auto then_op_result = std::make_shared<ngraph::opset1::Result>(resize);
|
||||
auto then_op_result = std::make_shared<ov::op::v0::Result>(resize);
|
||||
auto body_then_function =
|
||||
std::make_shared<ov::Model>(ov::NodeVector{then_op_result}, ov::ParameterVector{input_then});
|
||||
|
||||
// create else body
|
||||
auto input_else = std::make_shared<ov::opset8::Parameter>(ov::element::f32, ov::Shape{1, 3, 12, 12});
|
||||
auto else_op_result = std::make_shared<ngraph::opset1::Result>(input_else);
|
||||
auto else_op_result = std::make_shared<ov::op::v0::Result>(input_else);
|
||||
auto body_else_function =
|
||||
std::make_shared<ov::Model>(ov::NodeVector{else_op_result}, ov::ParameterVector{input_else});
|
||||
|
||||
// create main graph
|
||||
auto input = std::make_shared<ov::opset8::Parameter>(ov::element::f32, ov::Shape{1, 3, 12, 12});
|
||||
auto cond = std::make_shared<ngraph::opset1::Constant>(ngraph::element::boolean, ngraph::Shape{1}, true);
|
||||
auto cond = std::make_shared<ov::op::v0::Constant>(ngraph::element::boolean, ngraph::Shape{1}, true);
|
||||
auto if_op = std::make_shared<ov::opset8::If>(cond);
|
||||
if_op->set_then_body(body_then_function);
|
||||
if_op->set_else_body(body_else_function);
|
||||
if_op->set_input(input, input_then, input_else);
|
||||
if_op->set_output(then_op_result, else_op_result);
|
||||
auto if_result = std::make_shared<ngraph::opset1::Result>(if_op);
|
||||
auto if_result = std::make_shared<ov::op::v0::Result>(if_op);
|
||||
|
||||
function_ref =
|
||||
std::make_shared<ngraph::Function>(ngraph::NodeVector{if_result}, ngraph::ParameterVector{input});
|
||||
|
||||
@@ -13,6 +13,14 @@
|
||||
#include <transformations/init_node_info.hpp>
|
||||
|
||||
#include "common_test_utils/ngraph_test_utils.hpp"
|
||||
#include "openvino/op/add.hpp"
|
||||
#include "openvino/op/concat.hpp"
|
||||
#include "openvino/op/maximum.hpp"
|
||||
#include "openvino/op/minimum.hpp"
|
||||
#include "openvino/op/reduce_max.hpp"
|
||||
#include "openvino/op/reduce_min.hpp"
|
||||
#include "openvino/op/squeeze.hpp"
|
||||
#include "openvino/op/unsqueeze.hpp"
|
||||
|
||||
using namespace testing;
|
||||
using namespace ov;
|
||||
@@ -21,28 +29,29 @@ TEST_F(TransformationTestsF, ConcatReduceMaxFusionDynamicShape) {
|
||||
PartialShape shape{-1, -1, -1, -1};
|
||||
std::int64_t reduce_axis = 2;
|
||||
{
|
||||
auto left_input = std::make_shared<ov::opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto left_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(left_input,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(left_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
auto right_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(right_input,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(right_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
|
||||
auto concat = std::make_shared<opset8::Concat>(NodeVector{left_unsqueeze, right_unsqueeze}, reduce_axis);
|
||||
auto concat = std::make_shared<ov::op::v0::Concat>(NodeVector{left_unsqueeze, right_unsqueeze}, reduce_axis);
|
||||
|
||||
auto reduce_max =
|
||||
std::make_shared<opset8::ReduceMax>(concat, opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v1::ReduceMax>(concat,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
|
||||
function = std::make_shared<Model>(NodeVector{reduce_max}, ParameterVector{left_input, right_input});
|
||||
manager.register_pass<ov::pass::ConcatReduceFusion>();
|
||||
}
|
||||
{
|
||||
auto left_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto maximum = std::make_shared<opset8::Maximum>(left_input, right_input);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto maximum = std::make_shared<ov::op::v1::Maximum>(left_input, right_input);
|
||||
function_ref = std::make_shared<Model>(NodeVector{maximum}, ParameterVector{left_input, right_input});
|
||||
}
|
||||
}
|
||||
@@ -51,37 +60,37 @@ TEST_F(TransformationTestsF, ConcatReduceMaxFusionKeepDimsDynamicShape) {
|
||||
PartialShape shape{-1, -1, -1, -1};
|
||||
std::int64_t reduce_axis = 2;
|
||||
{
|
||||
auto left_input = std::make_shared<ov::opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto left_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(left_input,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(left_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
auto right_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(right_input,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(right_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
|
||||
auto concat = std::make_shared<opset8::Concat>(NodeVector{left_unsqueeze, right_unsqueeze}, reduce_axis);
|
||||
auto concat = std::make_shared<ov::op::v0::Concat>(NodeVector{left_unsqueeze, right_unsqueeze}, reduce_axis);
|
||||
|
||||
auto reduce_max =
|
||||
std::make_shared<opset8::ReduceMax>(concat,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}),
|
||||
true);
|
||||
std::make_shared<ov::op::v1::ReduceMax>(concat,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}),
|
||||
true);
|
||||
|
||||
function = std::make_shared<Model>(NodeVector{reduce_max}, ParameterVector{left_input, right_input});
|
||||
manager.register_pass<ov::pass::ConcatReduceFusion>();
|
||||
}
|
||||
{
|
||||
auto left_input = std::make_shared<ov::opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto left_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(left_input,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(left_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
auto right_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(right_input,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
auto maximum = std::make_shared<opset8::Maximum>(left_unsqueeze, right_unsqueeze);
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(right_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
auto maximum = std::make_shared<ov::op::v1::Maximum>(left_unsqueeze, right_unsqueeze);
|
||||
function_ref = std::make_shared<Model>(NodeVector{maximum}, ParameterVector{left_input, right_input});
|
||||
}
|
||||
}
|
||||
@@ -90,28 +99,29 @@ TEST_F(TransformationTestsF, ConcatReduceMaxFusionDynamicRank) {
|
||||
PartialShape shape = PartialShape::dynamic();
|
||||
std::int64_t reduce_axis = 3;
|
||||
{
|
||||
auto left_input = std::make_shared<ov::opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto left_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(left_input,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(left_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
auto right_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(right_input,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(right_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
|
||||
auto concat = std::make_shared<opset8::Concat>(NodeVector{left_unsqueeze, right_unsqueeze}, reduce_axis);
|
||||
auto concat = std::make_shared<ov::op::v0::Concat>(NodeVector{left_unsqueeze, right_unsqueeze}, reduce_axis);
|
||||
|
||||
auto reduce_max =
|
||||
std::make_shared<opset8::ReduceMax>(concat, opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v1::ReduceMax>(concat,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
|
||||
function = std::make_shared<Model>(NodeVector{reduce_max}, ParameterVector{left_input, right_input});
|
||||
manager.register_pass<ov::pass::ConcatReduceFusion>();
|
||||
}
|
||||
{
|
||||
auto left_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto maximum = std::make_shared<opset8::Maximum>(left_input, right_input);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto maximum = std::make_shared<ov::op::v1::Maximum>(left_input, right_input);
|
||||
function_ref = std::make_shared<Model>(NodeVector{maximum}, ParameterVector{left_input, right_input});
|
||||
}
|
||||
}
|
||||
@@ -120,28 +130,29 @@ TEST_F(TransformationTestsF, ConcatReduceMinFusionDynamicShape) {
|
||||
PartialShape shape{-1, -1, -1, -1};
|
||||
std::int64_t reduce_axis = 2;
|
||||
{
|
||||
auto left_input = std::make_shared<ov::opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto left_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(left_input,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(left_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
auto right_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(right_input,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(right_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
|
||||
auto concat = std::make_shared<opset8::Concat>(NodeVector{left_unsqueeze, right_unsqueeze}, reduce_axis);
|
||||
auto concat = std::make_shared<ov::op::v0::Concat>(NodeVector{left_unsqueeze, right_unsqueeze}, reduce_axis);
|
||||
|
||||
auto reduce_max =
|
||||
std::make_shared<opset8::ReduceMin>(concat, opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v1::ReduceMin>(concat,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
|
||||
function = std::make_shared<Model>(NodeVector{reduce_max}, ParameterVector{left_input, right_input});
|
||||
manager.register_pass<ov::pass::ConcatReduceFusion>();
|
||||
}
|
||||
{
|
||||
auto left_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto maximum = std::make_shared<opset8::Minimum>(left_input, right_input);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto maximum = std::make_shared<ov::op::v1::Minimum>(left_input, right_input);
|
||||
function_ref = std::make_shared<Model>(NodeVector{maximum}, ParameterVector{left_input, right_input});
|
||||
}
|
||||
}
|
||||
@@ -150,28 +161,29 @@ TEST_F(TransformationTestsF, ConcatReduceMinFusionDynamicRank) {
|
||||
PartialShape shape = PartialShape::dynamic();
|
||||
std::int64_t reduce_axis = 3;
|
||||
{
|
||||
auto left_input = std::make_shared<ov::opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto left_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(left_input,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(left_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
auto right_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(right_input,
|
||||
opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(right_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
|
||||
auto concat = std::make_shared<opset8::Concat>(NodeVector{left_unsqueeze, right_unsqueeze}, reduce_axis);
|
||||
auto concat = std::make_shared<ov::op::v0::Concat>(NodeVector{left_unsqueeze, right_unsqueeze}, reduce_axis);
|
||||
|
||||
auto reduce_max =
|
||||
std::make_shared<opset8::ReduceMin>(concat, opset8::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
std::make_shared<ov::op::v1::ReduceMin>(concat,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {reduce_axis}));
|
||||
|
||||
function = std::make_shared<Model>(NodeVector{reduce_max}, ParameterVector{left_input, right_input});
|
||||
manager.register_pass<ov::pass::ConcatReduceFusion>();
|
||||
}
|
||||
{
|
||||
auto left_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto maximum = std::make_shared<opset8::Minimum>(left_input, right_input);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto maximum = std::make_shared<ov::op::v1::Minimum>(left_input, right_input);
|
||||
function_ref = std::make_shared<Model>(NodeVector{maximum}, ParameterVector{left_input, right_input});
|
||||
}
|
||||
}
|
||||
@@ -179,36 +191,43 @@ TEST_F(TransformationTestsF, ConcatReduceMinFusionDynamicRank) {
|
||||
TEST_F(TransformationTestsF, PullSqueezeThroughEltwiseStaticShape) {
|
||||
PartialShape shape{224, 224, 1, 1};
|
||||
{
|
||||
auto left_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto left_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(left_input, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(left_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
auto right_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(right_input, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(right_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
|
||||
auto add = std::make_shared<opset8::Add>(left_unsqueeze, right_unsqueeze);
|
||||
auto add = std::make_shared<ov::op::v1::Add>(left_unsqueeze, right_unsqueeze);
|
||||
|
||||
auto squeeze = std::make_shared<opset8::Squeeze>(add, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
auto squeeze =
|
||||
std::make_shared<ov::op::v0::Squeeze>(add, ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
|
||||
function = std::make_shared<Model>(NodeVector{squeeze}, ParameterVector{left_input, right_input});
|
||||
manager.register_pass<ov::pass::PullSqueezeThroughEltwise>();
|
||||
}
|
||||
{
|
||||
auto left_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto left_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(left_input, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(left_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
auto left_squeeze =
|
||||
std::make_shared<opset8::Squeeze>(left_unsqueeze, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<ov::op::v0::Squeeze>(left_unsqueeze,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
|
||||
auto right_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(right_input, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(right_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
auto right_squeeze =
|
||||
std::make_shared<opset8::Squeeze>(right_unsqueeze, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<ov::op::v0::Squeeze>(right_unsqueeze,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
|
||||
auto add = std::make_shared<opset8::Add>(left_squeeze, right_squeeze);
|
||||
auto add = std::make_shared<ov::op::v1::Add>(left_squeeze, right_squeeze);
|
||||
|
||||
function_ref = std::make_shared<Model>(NodeVector{add}, ParameterVector{left_input, right_input});
|
||||
}
|
||||
@@ -217,26 +236,29 @@ TEST_F(TransformationTestsF, PullSqueezeThroughEltwiseStaticShape) {
|
||||
TEST_F(TransformationTestsF, PullSqueezeThroughEltwiseSqueezeEliminationStaticShape) {
|
||||
PartialShape shape{224, 224, 1, 1};
|
||||
{
|
||||
auto left_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto left_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(left_input, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(left_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
auto right_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(right_input, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(right_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
|
||||
auto add = std::make_shared<opset8::Add>(left_unsqueeze, right_unsqueeze);
|
||||
auto add = std::make_shared<ov::op::v1::Add>(left_unsqueeze, right_unsqueeze);
|
||||
|
||||
auto squeeze = std::make_shared<opset8::Squeeze>(add, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
auto squeeze =
|
||||
std::make_shared<ov::op::v0::Squeeze>(add, ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
|
||||
function = std::make_shared<Model>(NodeVector{squeeze}, ParameterVector{left_input, right_input});
|
||||
manager.register_pass<ov::pass::ConcatReduceFusion>();
|
||||
}
|
||||
{
|
||||
auto left_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto add = std::make_shared<opset8::Add>(left_input, right_input);
|
||||
auto add = std::make_shared<ov::op::v1::Add>(left_input, right_input);
|
||||
|
||||
function_ref = std::make_shared<Model>(NodeVector{add}, ParameterVector{left_input, right_input});
|
||||
}
|
||||
@@ -245,26 +267,29 @@ TEST_F(TransformationTestsF, PullSqueezeThroughEltwiseSqueezeEliminationStaticSh
|
||||
TEST_F(TransformationTestsF, PullSqueezeThroughEltwiseSqueezeEliminationDynamicShape) {
|
||||
PartialShape shape{-1, -1, -1, -1};
|
||||
{
|
||||
auto left_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto left_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(left_input, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(left_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
auto right_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(right_input, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(right_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
|
||||
auto add = std::make_shared<opset8::Add>(left_unsqueeze, right_unsqueeze);
|
||||
auto add = std::make_shared<ov::op::v1::Add>(left_unsqueeze, right_unsqueeze);
|
||||
|
||||
auto squeeze = std::make_shared<opset8::Squeeze>(add, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
auto squeeze =
|
||||
std::make_shared<ov::op::v0::Squeeze>(add, ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
|
||||
function = std::make_shared<Model>(NodeVector{squeeze}, ParameterVector{left_input, right_input});
|
||||
manager.register_pass<ov::pass::ConcatReduceFusion>();
|
||||
}
|
||||
{
|
||||
auto left_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto add = std::make_shared<opset8::Add>(left_input, right_input);
|
||||
auto add = std::make_shared<ov::op::v1::Add>(left_input, right_input);
|
||||
|
||||
function_ref = std::make_shared<Model>(NodeVector{add}, ParameterVector{left_input, right_input});
|
||||
}
|
||||
@@ -273,26 +298,29 @@ TEST_F(TransformationTestsF, PullSqueezeThroughEltwiseSqueezeEliminationDynamicS
|
||||
TEST_F(TransformationTestsF, PullSqueezeThroughEltwiseSqueezeEliminationDynamicRank) {
|
||||
PartialShape shape = PartialShape::dynamic();
|
||||
{
|
||||
auto left_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto left_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(left_input, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(left_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
auto right_unsqueeze =
|
||||
std::make_shared<opset8::Unsqueeze>(right_input, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<ov::op::v0::Unsqueeze>(right_input,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
|
||||
auto add = std::make_shared<opset8::Add>(left_unsqueeze, right_unsqueeze);
|
||||
auto add = std::make_shared<ov::op::v1::Add>(left_unsqueeze, right_unsqueeze);
|
||||
|
||||
auto squeeze = std::make_shared<opset8::Squeeze>(add, opset8::Constant::create(element::i64, Shape{}, {0}));
|
||||
auto squeeze =
|
||||
std::make_shared<ov::op::v0::Squeeze>(add, ov::op::v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
|
||||
function = std::make_shared<Model>(NodeVector{squeeze}, ParameterVector{left_input, right_input});
|
||||
manager.register_pass<ov::pass::ConcatReduceFusion>();
|
||||
}
|
||||
{
|
||||
auto left_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<opset8::Parameter>(element::f32, shape);
|
||||
auto left_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
auto right_input = std::make_shared<ov::op::v0::Parameter>(element::f32, shape);
|
||||
|
||||
auto add = std::make_shared<opset8::Add>(left_input, right_input);
|
||||
auto add = std::make_shared<ov::op::v1::Add>(left_input, right_input);
|
||||
|
||||
function_ref = std::make_shared<Model>(NodeVector{add}, ParameterVector{left_input, right_input});
|
||||
}
|
||||
|
||||
+1
-1
@@ -204,5 +204,5 @@ TEST(TransformationTests, test_convert_to_unsigned_nms_gather_3) {
|
||||
manager.register_pass<ov::pass::ConvertNmsGatherPathToUnsigned>();
|
||||
manager.run_passes(f);
|
||||
ASSERT_NO_THROW(check_rt_info(f));
|
||||
ASSERT_EQ(count_ops_of_type<opset1::Convert>(f), 0);
|
||||
ASSERT_EQ(count_ops_of_type<ov::op::v0::Convert>(f), 0);
|
||||
}
|
||||
@@ -73,12 +73,12 @@ public:
|
||||
};
|
||||
|
||||
TEST_P(FQMulFusion, ExpectFusion) {
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ngraph::pass::InitUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InitNodeInfo>();
|
||||
manager.register_pass<ov::pass::FakeQuantizeMulFusion>();
|
||||
manager.register_pass<ngraph::pass::CheckUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
|
||||
manager.run_passes(m_function);
|
||||
ASSERT_NO_THROW(check_rt_info(m_function));
|
||||
|
||||
@@ -123,12 +123,12 @@ private:
|
||||
};
|
||||
|
||||
TEST_P(nGraphFQReshapeFusionTests, ReshapeMatMul) {
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ngraph::pass::InitUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InitNodeInfo>();
|
||||
manager.register_pass<ov::pass::FakeQuantizeReshapeFusion>();
|
||||
manager.register_pass<ngraph::pass::CheckUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
|
||||
manager.run_passes(f);
|
||||
ASSERT_NO_THROW(check_rt_info(f));
|
||||
|
||||
@@ -45,7 +45,7 @@ TEST_F(TransformationTestsF, GeluFusionPatternOne) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f32, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 2});
|
||||
auto gelu = std::make_shared<opset7::Gelu>(data);
|
||||
function_ref = std::make_shared<Function>(NodeVector{gelu}, ParameterVector{data});
|
||||
}
|
||||
@@ -71,7 +71,7 @@ TEST_F(TransformationTestsF, GeluFusionPatternOneF16) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f16, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f16, Shape{2, 2});
|
||||
auto gelu = std::make_shared<opset7::Gelu>(data);
|
||||
function_ref = std::make_shared<Function>(NodeVector{gelu}, ParameterVector{data});
|
||||
}
|
||||
@@ -97,7 +97,7 @@ TEST_F(TransformationTestsF, GeluFusionPatternTwo) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f32, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 2});
|
||||
auto gelu = std::make_shared<opset7::Gelu>(data);
|
||||
function_ref = std::make_shared<Function>(NodeVector{gelu}, ParameterVector{data});
|
||||
}
|
||||
@@ -123,7 +123,7 @@ TEST_F(TransformationTestsF, GeluFusionPatternTwoF16) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f16, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f16, Shape{2, 2});
|
||||
auto gelu = std::make_shared<opset7::Gelu>(data);
|
||||
function_ref = std::make_shared<Function>(NodeVector{gelu}, ParameterVector{data});
|
||||
}
|
||||
@@ -149,7 +149,7 @@ TEST_F(TransformationTestsF, GeluFusionPatternThree) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f32, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 2});
|
||||
auto gelu = std::make_shared<opset7::Gelu>(data);
|
||||
function_ref = std::make_shared<Function>(NodeVector{gelu}, ParameterVector{data});
|
||||
}
|
||||
@@ -175,7 +175,7 @@ TEST_F(TransformationTestsF, GeluFusionPatternThreeF16) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f16, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f16, Shape{2, 2});
|
||||
auto gelu = std::make_shared<opset7::Gelu>(data);
|
||||
function_ref = std::make_shared<Function>(NodeVector{gelu}, ParameterVector{data});
|
||||
}
|
||||
@@ -201,7 +201,7 @@ TEST_F(TransformationTestsF, GeluFusionPatternFour) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f32, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 2});
|
||||
auto gelu = std::make_shared<opset9::Gelu>(data);
|
||||
function_ref = std::make_shared<Function>(NodeVector{gelu}, ParameterVector{data});
|
||||
}
|
||||
@@ -227,7 +227,7 @@ TEST_F(TransformationTestsF, GeluFusionPatternFourF16) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f16, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f16, Shape{2, 2});
|
||||
auto gelu = std::make_shared<opset9::Gelu>(data);
|
||||
function_ref = std::make_shared<Function>(NodeVector{gelu}, ParameterVector{data});
|
||||
}
|
||||
|
||||
@@ -146,13 +146,12 @@ TEST_F(TransformationTestsF, HSigmoidFusionWithClampMul) {
|
||||
|
||||
TEST_F(TransformationTestsF, HSigmoidFusionWithClampDiv) {
|
||||
{
|
||||
auto input =
|
||||
std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f16, ngraph::PartialShape::dynamic(1));
|
||||
auto add_constant = ngraph::opset6::Constant::create(ngraph::element::f16, ngraph::Shape{}, {3.0});
|
||||
auto add = std::make_shared<ngraph::opset6::Add>(input, add_constant);
|
||||
auto clamp = std::make_shared<ngraph::opset6::Clamp>(add, 0.0f, 6.0f);
|
||||
auto div_constant = ngraph::opset6::Constant::create(ngraph::element::f16, ngraph::Shape{}, {6.0});
|
||||
auto div = std::make_shared<ngraph::opset6::Divide>(clamp, div_constant);
|
||||
auto input = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f16, ngraph::PartialShape::dynamic(1));
|
||||
auto add_constant = ov::op::v0::Constant::create(ngraph::element::f16, ngraph::Shape{}, {3.0});
|
||||
auto add = std::make_shared<ov::op::v1::Add>(input, add_constant);
|
||||
auto clamp = std::make_shared<ov::op::v0::Clamp>(add, 0.0f, 6.0f);
|
||||
auto div_constant = ov::op::v0::Constant::create(ngraph::element::f16, ngraph::Shape{}, {6.0});
|
||||
auto div = std::make_shared<ov::op::v1::Divide>(clamp, div_constant);
|
||||
|
||||
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{div}, ngraph::ParameterVector{input});
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ TEST_F(TransformationTestsF, LeakyReluFusionConstant) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f32, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 2});
|
||||
auto alpha = opset8::Constant::create(element::f32, Shape{1}, {0.1});
|
||||
auto leaky_relu = std::make_shared<opset8::PRelu>(data, alpha);
|
||||
function_ref = std::make_shared<Function>(NodeVector{leaky_relu}, ParameterVector{data});
|
||||
@@ -51,7 +51,7 @@ TEST_F(TransformationTestsF, LeakyReluFusionScalar) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f32, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 2});
|
||||
auto alpha = opset8::Constant::create(element::f32, Shape{}, {0.1});
|
||||
auto leaky_relu = std::make_shared<opset8::PRelu>(data, alpha);
|
||||
function_ref = std::make_shared<Function>(NodeVector{leaky_relu}, ParameterVector{data});
|
||||
@@ -70,7 +70,7 @@ TEST_F(TransformationTestsF, LeakyReluFusionParameter) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<opset1::Parameter>(element::f32, Shape{2, 2});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{2, 2});
|
||||
auto alpha = std::make_shared<opset8::Parameter>(element::f32, Shape{});
|
||||
auto leaky_relu = std::make_shared<opset8::PRelu>(data, alpha);
|
||||
function_ref = std::make_shared<Function>(NodeVector{leaky_relu}, ParameterVector{data, alpha});
|
||||
|
||||
@@ -594,7 +594,7 @@ TEST(TransformationTests, LowLatency2_LSTM_Loop_Reshape) {
|
||||
auto results = body->get_results();
|
||||
|
||||
auto shape_of = std::make_shared<ShapeOf>(X);
|
||||
const auto trip_count = std::make_shared<ov::opset8::Gather>(shape_of,
|
||||
const auto trip_count = std::make_shared<ov::op::v8::Gather>(shape_of,
|
||||
Constant::create(ngraph::element::i64, {1}, {0}),
|
||||
Constant::create(ngraph::element::i64, {1}, {0}));
|
||||
auto exec_condition = std::make_shared<Constant>(element::boolean, Shape{}, true);
|
||||
|
||||
+26
-25
@@ -20,37 +20,38 @@
|
||||
|
||||
#include "common_test_utils/ngraph_test_utils.hpp"
|
||||
#include "common_test_utils/test_common.hpp"
|
||||
#include "openvino/op/sigmoid.hpp"
|
||||
|
||||
using namespace testing;
|
||||
|
||||
TEST_F(TransformationTestsF, FQTransposeTest1) {
|
||||
{
|
||||
auto data = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1, 1, 3}, {1, 2, 3});
|
||||
auto input_low = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {2});
|
||||
auto input_high = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {3});
|
||||
auto output_low = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {2});
|
||||
auto output_high = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {3});
|
||||
auto transpose_order = ngraph::op::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {0, 2, 1});
|
||||
auto data = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1, 1, 3}, {1, 2, 3});
|
||||
auto input_low = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {2});
|
||||
auto input_high = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {3});
|
||||
auto output_low = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {2});
|
||||
auto output_high = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {3});
|
||||
auto transpose_order = ov::op::v0::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {0, 2, 1});
|
||||
|
||||
auto fq = std::make_shared<ngraph::op::FakeQuantize>(data, input_low, input_high, output_low, output_high, 1);
|
||||
auto transpose = std::make_shared<ngraph::op::Transpose>(fq, transpose_order);
|
||||
auto fq = std::make_shared<ov::op::v0::FakeQuantize>(data, input_low, input_high, output_low, output_high, 1);
|
||||
auto transpose = std::make_shared<ov::op::v1::Transpose>(fq, transpose_order);
|
||||
|
||||
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{transpose}, ngraph::ParameterVector{});
|
||||
|
||||
manager.register_pass<ov::pass::PullTransposeThroughFQUp>();
|
||||
manager.register_pass<ngraph::pass::InjectionPass>([](std::shared_ptr<ngraph::Function> f) {
|
||||
manager.register_pass<ov::pass::InjectionPass>([](std::shared_ptr<ngraph::Function> f) {
|
||||
check_rt_info(f);
|
||||
});
|
||||
manager.register_pass<ngraph::pass::ConstantFolding>();
|
||||
}
|
||||
{
|
||||
auto data = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1, 3, 1}, {1, 2, 3});
|
||||
auto input_low = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1, 1, 1}, {2});
|
||||
auto input_high = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1, 1, 1}, {3});
|
||||
auto output_low = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1, 1, 1}, {2});
|
||||
auto output_high = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1, 1, 1}, {3});
|
||||
auto data = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1, 3, 1}, {1, 2, 3});
|
||||
auto input_low = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1, 1, 1}, {2});
|
||||
auto input_high = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1, 1, 1}, {3});
|
||||
auto output_low = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1, 1, 1}, {2});
|
||||
auto output_high = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1, 1, 1}, {3});
|
||||
|
||||
auto fq = std::make_shared<ngraph::op::FakeQuantize>(data, input_low, input_high, output_low, output_high, 1);
|
||||
auto fq = std::make_shared<ov::op::v0::FakeQuantize>(data, input_low, input_high, output_low, output_high, 1);
|
||||
|
||||
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{fq}, ngraph::ParameterVector{});
|
||||
}
|
||||
@@ -58,17 +59,17 @@ TEST_F(TransformationTestsF, FQTransposeTest1) {
|
||||
|
||||
TEST_F(TransformationTestsF, FQTransposeNegativeCase) {
|
||||
auto create_graph = []() -> std::shared_ptr<ngraph::Function> {
|
||||
auto data = std::make_shared<ngraph::op::Parameter>(ngraph::element::f32, ngraph::PartialShape{1, 3, 1});
|
||||
auto sigmoid = std::make_shared<ngraph::op::Sigmoid>(data);
|
||||
auto input_low = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {2});
|
||||
auto input_high = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {3});
|
||||
auto output_low = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {2});
|
||||
auto output_high = ngraph::op::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {3});
|
||||
auto transpose_order = ngraph::op::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {0, 2, 1});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::PartialShape{1, 3, 1});
|
||||
auto sigmoid = std::make_shared<ov::op::v0::Sigmoid>(data);
|
||||
auto input_low = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {2});
|
||||
auto input_high = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {3});
|
||||
auto output_low = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {2});
|
||||
auto output_high = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {3});
|
||||
auto transpose_order = ov::op::v0::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {0, 2, 1});
|
||||
|
||||
auto fq =
|
||||
std::make_shared<ngraph::op::FakeQuantize>(sigmoid, input_low, input_high, output_low, output_high, 1);
|
||||
auto transpose = std::make_shared<ngraph::op::Transpose>(fq, transpose_order);
|
||||
std::make_shared<ov::op::v0::FakeQuantize>(sigmoid, input_low, input_high, output_low, output_high, 1);
|
||||
auto transpose = std::make_shared<ov::op::v1::Transpose>(fq, transpose_order);
|
||||
|
||||
return std::make_shared<ngraph::Function>(ngraph::NodeVector{transpose}, ngraph::ParameterVector{data});
|
||||
};
|
||||
@@ -76,7 +77,7 @@ TEST_F(TransformationTestsF, FQTransposeNegativeCase) {
|
||||
|
||||
manager.register_pass<ov::pass::InitNodeInfo>();
|
||||
manager.register_pass<ov::pass::PullTransposeThroughFQUp>();
|
||||
manager.register_pass<ngraph::pass::InjectionPass>([](std::shared_ptr<ngraph::Function> f) {
|
||||
manager.register_pass<ov::pass::InjectionPass>([](std::shared_ptr<ngraph::Function> f) {
|
||||
check_rt_info(f);
|
||||
});
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ using namespace ngraph;
|
||||
using namespace std;
|
||||
|
||||
TEST(nop_elimination, eliminate_convert) {
|
||||
std::shared_ptr<Function> f;
|
||||
std::shared_ptr<ov::Model> f;
|
||||
{
|
||||
Shape shape{};
|
||||
auto type = element::f32;
|
||||
auto A = make_shared<op::Parameter>(type, shape);
|
||||
auto c = make_shared<op::v0::Convert>(A, element::f32);
|
||||
f = make_shared<Function>(make_shared<op::v0::Abs>(c), ParameterVector{A});
|
||||
f = make_shared<ov::Model>(make_shared<op::v0::Abs>(c), ParameterVector{A});
|
||||
}
|
||||
|
||||
pass::Manager pass_manager;
|
||||
@@ -46,14 +46,13 @@ TEST(nop_elimination, eliminate_convert) {
|
||||
|
||||
TEST(nop_elimination, convert_type_agnostic) {
|
||||
Shape shape{};
|
||||
std::shared_ptr<Function> f;
|
||||
std::shared_ptr<ov::Model> f;
|
||||
{
|
||||
auto type = element::from<int8_t>();
|
||||
auto A = make_shared<op::Parameter>(type, shape);
|
||||
auto c1 = make_shared<op::v0::Convert>(A, element::from<uint8_t>());
|
||||
auto c = make_shared<op::v0::Convert>(c1, element::f32);
|
||||
auto A = make_shared<op::Parameter>(ov::element::i8, shape);
|
||||
auto c1 = make_shared<op::v0::Convert>(A, ov::element::u8);
|
||||
auto c = make_shared<op::v0::Convert>(c1, ov::element::f32);
|
||||
auto z = make_shared<op::v3::NonZero>(c);
|
||||
f = make_shared<Function>(make_shared<op::v0::Abs>(z), ParameterVector{A});
|
||||
f = make_shared<ov::Model>(make_shared<op::v0::Abs>(z), ParameterVector{A});
|
||||
}
|
||||
|
||||
pass::Manager pass_manager;
|
||||
@@ -66,12 +65,12 @@ TEST(nop_elimination, convert_type_agnostic) {
|
||||
|
||||
template <typename Op>
|
||||
void test_nop_eliminate_broadcast() {
|
||||
std::shared_ptr<Function> f;
|
||||
std::shared_ptr<ov::Model> f;
|
||||
{
|
||||
Shape shape{1};
|
||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
||||
auto b = make_shared<Op>(A, op::Constant::create(element::u64, Shape{1}, {1}));
|
||||
f = make_shared<Function>(make_shared<op::v0::Abs>(b), ParameterVector{A});
|
||||
f = make_shared<ov::Model>(make_shared<op::v0::Abs>(b), ParameterVector{A});
|
||||
}
|
||||
|
||||
pass::Manager pass_manager;
|
||||
@@ -102,7 +101,7 @@ TEST(nop_elimination, reshape_elimination_v1) {
|
||||
auto reshape_v1_org = std::make_shared<op::v1::Reshape>(arg, pattern_org, zero);
|
||||
auto reshape_v1 = std::make_shared<op::v1::Reshape>(reshape_v1_org, pattern, zero);
|
||||
auto abs = std::make_shared<op::v0::Abs>(reshape_v1);
|
||||
return std::make_shared<Function>(NodeVector{abs}, ParameterVector{arg});
|
||||
return std::make_shared<ov::Model>(NodeVector{abs}, ParameterVector{arg});
|
||||
};
|
||||
|
||||
auto func = generate_func(false);
|
||||
@@ -145,7 +144,7 @@ TEST(nop_elimination, reshape_v1_1D) {
|
||||
}
|
||||
|
||||
TEST(nop_elimination, squeeze_reshape_elimination_check_info) {
|
||||
std::shared_ptr<Function> f;
|
||||
std::shared_ptr<ov::Model> f;
|
||||
{
|
||||
auto arg = std::make_shared<opset4::Parameter>(element::f32, PartialShape{8, 16, 1, 3});
|
||||
|
||||
@@ -162,7 +161,7 @@ TEST(nop_elimination, squeeze_reshape_elimination_check_info) {
|
||||
|
||||
auto abs = std::make_shared<opset4::Abs>(reshape);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{abs}, ParameterVector{arg});
|
||||
f = std::make_shared<ov::Model>(NodeVector{abs}, ParameterVector{arg});
|
||||
}
|
||||
|
||||
pass::Manager pass_manager;
|
||||
@@ -180,7 +179,7 @@ TEST(nop_elimination, squeeze_reshape_elimination_check_info) {
|
||||
}
|
||||
|
||||
TEST(nop_elimination, squeeze_unsqueeze_elimination) {
|
||||
std::shared_ptr<Function> f;
|
||||
std::shared_ptr<ov::Model> f;
|
||||
{
|
||||
auto arg = std::make_shared<opset4::Parameter>(element::f32, PartialShape{8, 16, 1, 3});
|
||||
|
||||
@@ -197,7 +196,7 @@ TEST(nop_elimination, squeeze_unsqueeze_elimination) {
|
||||
|
||||
auto abs = std::make_shared<opset4::Abs>(unsqueeze);
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{abs}, ParameterVector{arg});
|
||||
f = std::make_shared<ov::Model>(NodeVector{abs}, ParameterVector{arg});
|
||||
}
|
||||
|
||||
pass::Manager pass_manager;
|
||||
@@ -219,7 +218,7 @@ TEST(nop_elimination, reshape_elimination_v1_dynamic) {
|
||||
auto pattern = make_shared<op::Parameter>(element::i64, PartialShape::dynamic(1));
|
||||
auto reshape_v1 = std::make_shared<op::v1::Reshape>(arg, pattern, false);
|
||||
auto abs = std::make_shared<op::v0::Abs>(reshape_v1);
|
||||
auto f = std::make_shared<Function>(NodeVector{abs}, ParameterVector{arg, pattern});
|
||||
auto f = std::make_shared<ov::Model>(NodeVector{abs}, ParameterVector{arg, pattern});
|
||||
pass::Manager pass_manager;
|
||||
pass_manager.register_pass<ov::pass::NopElimination>();
|
||||
pass_manager.run_passes(f);
|
||||
@@ -227,7 +226,7 @@ TEST(nop_elimination, reshape_elimination_v1_dynamic) {
|
||||
}
|
||||
|
||||
TEST(nop_elimination, reshape_elimination_v1_check_consumer_count) {
|
||||
std::shared_ptr<Function> f;
|
||||
std::shared_ptr<ov::Model> f;
|
||||
{
|
||||
auto arg = std::make_shared<opset4::Parameter>(element::f32, PartialShape{8, 16, 1, 3});
|
||||
|
||||
@@ -242,7 +241,7 @@ TEST(nop_elimination, reshape_elimination_v1_check_consumer_count) {
|
||||
auto relu = std::make_shared<opset4::Relu>(reshape_1);
|
||||
relu->set_friendly_name("relu");
|
||||
|
||||
f = std::make_shared<Function>(NodeVector{reshape_2, relu}, ParameterVector{arg});
|
||||
f = std::make_shared<ov::Model>(NodeVector{reshape_2, relu}, ParameterVector{arg});
|
||||
}
|
||||
|
||||
pass::Manager pass_manager;
|
||||
@@ -256,7 +255,7 @@ TEST(nop_elimination, reshape_elimination_v1_check_consumer_count) {
|
||||
TEST(nop_elimination, concat_elimination_single_node) {
|
||||
int64_t a = 0;
|
||||
auto A = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
auto f = make_shared<Function>(make_shared<op::v0::Concat>(NodeVector{A}, a), ParameterVector{A});
|
||||
auto f = make_shared<ov::Model>(make_shared<op::v0::Concat>(NodeVector{A}, a), ParameterVector{A});
|
||||
|
||||
pass::Manager pass_manager;
|
||||
pass_manager.register_pass<ov::pass::Validate>();
|
||||
@@ -270,7 +269,7 @@ TEST(nop_elimination, concat_elimination_single_input) {
|
||||
int64_t a = 0;
|
||||
auto A = make_shared<op::Parameter>(element::f32, Shape{2, 3});
|
||||
auto B = make_shared<op::v0::Concat>(NodeVector{A}, a);
|
||||
auto f = make_shared<Function>(make_shared<op::v0::Abs>(B), ParameterVector{A});
|
||||
auto f = make_shared<ov::Model>(make_shared<op::v0::Abs>(B), ParameterVector{A});
|
||||
|
||||
pass::Manager pass_manager;
|
||||
pass_manager.register_pass<ov::pass::Validate>();
|
||||
@@ -284,7 +283,7 @@ TEST(nop_elimination, concat_elimination_single_input_dynamic) {
|
||||
int64_t a = 0;
|
||||
auto A = make_shared<op::Parameter>(element::f32, PartialShape{Dimension::dynamic(), 3});
|
||||
auto B = make_shared<op::v0::Concat>(NodeVector{A}, a);
|
||||
auto f = make_shared<Function>(make_shared<op::v0::Abs>(B), ParameterVector{A});
|
||||
auto f = make_shared<ov::Model>(make_shared<op::v0::Abs>(B), ParameterVector{A});
|
||||
|
||||
pass::Manager pass_manager;
|
||||
pass_manager.register_pass<ov::pass::Validate>();
|
||||
@@ -299,7 +298,7 @@ TEST(nop_elimination, unsqueeze_elimination) {
|
||||
const auto A =
|
||||
make_shared<op::Parameter>(element::f32, PartialShape{3, Dimension::dynamic(), Dimension::dynamic()});
|
||||
const auto unsqueeze = make_shared<op::v0::Unsqueeze>(A, axis);
|
||||
auto f = make_shared<Function>(unsqueeze, ParameterVector{A});
|
||||
auto f = make_shared<ov::Model>(unsqueeze, ParameterVector{A});
|
||||
|
||||
pass::Manager pass_manager;
|
||||
pass_manager.register_pass<ov::pass::Validate>();
|
||||
@@ -369,8 +368,8 @@ TEST(nop_elimination, squeeze_unsqueeze_overlap_elimination) {
|
||||
B1 = make_shared<op::v0::Squeeze>(B, sq_axes);
|
||||
}
|
||||
|
||||
auto baseline_f = make_shared<Function>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = clone_function(*baseline_f);
|
||||
auto baseline_f = make_shared<ov::Model>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = baseline_f->clone();
|
||||
|
||||
pass::Manager pass_manager;
|
||||
pass_manager.register_pass<ov::pass::Validate>();
|
||||
@@ -561,8 +560,8 @@ TEST(nop_elimination, squeeze_squeeze_overlap_elimination) {
|
||||
auto A1 = make_shared<op::v0::Abs>(A);
|
||||
auto B = make_shared<op::v0::Squeeze>(A1, sq_axes_1);
|
||||
auto B1 = make_shared<op::v0::Squeeze>(B, sq_axes_2);
|
||||
auto baseline_f = make_shared<Function>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = clone_function(*baseline_f);
|
||||
auto baseline_f = make_shared<ov::Model>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = baseline_f->clone();
|
||||
|
||||
pass::Manager pass_manager;
|
||||
pass_manager.register_pass<ov::pass::Validate>();
|
||||
@@ -595,8 +594,8 @@ TEST(nop_elimination, unsqueeze_unsqueeze_overlap_elimination) {
|
||||
auto A1 = make_shared<op::v0::Abs>(A);
|
||||
auto B = make_shared<op::v0::Unsqueeze>(A1, unsq_axes_1);
|
||||
auto B1 = make_shared<op::v0::Unsqueeze>(B, unsq_axes_2);
|
||||
auto baseline_f = make_shared<Function>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = clone_function(*baseline_f);
|
||||
auto baseline_f = make_shared<ov::Model>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = baseline_f->clone();
|
||||
|
||||
pass::Manager pass_manager;
|
||||
pass_manager.register_pass<ov::pass::Validate>();
|
||||
@@ -623,7 +622,7 @@ TEST(nop_elimination, unsqueeze_squeeze_elimination) {
|
||||
auto A1 = make_shared<op::v0::Abs>(A);
|
||||
auto B = make_shared<op::v0::Unsqueeze>(A1, axes);
|
||||
auto B1 = make_shared<op::v0::Squeeze>(B, axes);
|
||||
return make_shared<Function>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
return make_shared<ov::Model>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
};
|
||||
|
||||
auto check_usecase = [&](const Shape& shape, const std::vector<int64_t>& axes_val) {
|
||||
@@ -656,8 +655,8 @@ TEST(nop_elimination, reshape_unsqueeze_elimination) {
|
||||
auto B = make_shared<op::v1::Reshape>(A1, pat, zero);
|
||||
auto pat2 = op::Constant::create<int64_t>(element::i64, Shape{2}, std::vector<int64_t>{0, -1});
|
||||
auto B1 = make_shared<op::v0::Unsqueeze>(B, axes);
|
||||
auto baseline_f = make_shared<Function>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = clone_function(*baseline_f);
|
||||
auto baseline_f = make_shared<ov::Model>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = baseline_f->clone();
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ov::pass::NopElimination>();
|
||||
manager.run_passes(optimized_f);
|
||||
@@ -684,8 +683,8 @@ TEST(nop_elimination, reshape_squeeze_elimination) {
|
||||
auto B = make_shared<op::v1::Reshape>(A1, pat, zero);
|
||||
auto pat2 = op::Constant::create<int64_t>(element::i64, Shape{2}, std::vector<int64_t>{0, -1});
|
||||
auto B1 = make_shared<op::v0::Squeeze>(B, axes);
|
||||
auto baseline_f = make_shared<Function>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = clone_function(*baseline_f);
|
||||
auto baseline_f = make_shared<ov::Model>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = baseline_f->clone();
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ov::pass::NopElimination>();
|
||||
manager.run_passes(optimized_f);
|
||||
@@ -711,8 +710,8 @@ TEST(nop_elimination, reshape_reshape_elimination) {
|
||||
auto B = make_shared<op::v1::Reshape>(A1, pat, zero);
|
||||
auto pat2 = op::Constant::create<int64_t>(element::i64, Shape{2}, std::vector<int64_t>{0, -1});
|
||||
auto B1 = make_shared<op::v1::Reshape>(B, pat2, true);
|
||||
auto baseline_f = make_shared<Function>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = clone_function(*baseline_f);
|
||||
auto baseline_f = make_shared<ov::Model>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = baseline_f->clone();
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ov::pass::NopElimination>();
|
||||
manager.run_passes(optimized_f);
|
||||
@@ -737,8 +736,8 @@ TEST(nop_elimination, squeeze_reshape_elimination) {
|
||||
auto B = make_shared<op::v0::Squeeze>(A1, indices);
|
||||
auto pat2 = op::Constant::create<int64_t>(element::i64, Shape{1}, std::vector<int64_t>{-1});
|
||||
auto B1 = make_shared<op::v1::Reshape>(B, pat2, false);
|
||||
auto baseline_f = make_shared<Function>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = clone_function(*baseline_f);
|
||||
auto baseline_f = make_shared<ov::Model>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = baseline_f->clone();
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ov::pass::NopElimination>();
|
||||
manager.run_passes(optimized_f);
|
||||
@@ -764,8 +763,8 @@ TEST(nop_elimination, unsqueeze_reshape_elimination) {
|
||||
auto B = make_shared<op::v0::Unsqueeze>(A1, indices);
|
||||
auto pat2 = op::Constant::create<int64_t>(element::i64, Shape{1}, std::vector<int64_t>{-1});
|
||||
auto B1 = make_shared<op::v1::Reshape>(B, pat2, false);
|
||||
auto baseline_f = make_shared<Function>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = clone_function(*baseline_f);
|
||||
auto baseline_f = make_shared<ov::Model>(make_shared<op::v0::Abs>(B1), ParameterVector{A});
|
||||
auto optimized_f = baseline_f->clone();
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ov::pass::NopElimination>();
|
||||
manager.run_passes(optimized_f);
|
||||
@@ -787,8 +786,8 @@ TEST(nop_elimination, squeeze_unsqueeze_elimination_negative) {
|
||||
auto indices = op::Constant::create(element::i64, Shape{indices_val.size()}, indices_val);
|
||||
auto input = make_shared<op::Parameter>(element::f32, shape);
|
||||
auto squeeze = make_shared<ngraph::opset1::Squeeze>(input, indices);
|
||||
auto baseline_f = make_shared<Function>(squeeze, ParameterVector{input});
|
||||
auto optimized_f = clone_function(*baseline_f);
|
||||
auto baseline_f = make_shared<ov::Model>(squeeze, ParameterVector{input});
|
||||
auto optimized_f = baseline_f->clone();
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ov::pass::NopElimination>();
|
||||
manager.run_passes(optimized_f);
|
||||
@@ -809,8 +808,8 @@ TEST(nop_elimination, topk_convert_elimination) {
|
||||
op::v1::TopK::Mode::MAX,
|
||||
op::v1::TopK::SortType::NONE);
|
||||
auto C = make_shared<op::Convert>(B->output(0), B->output(0).get_element_type());
|
||||
auto baseline_f = make_shared<Function>(make_shared<op::v0::Abs>(C), ParameterVector{A});
|
||||
auto optimized_f = clone_function(*baseline_f);
|
||||
auto baseline_f = make_shared<ov::Model>(make_shared<op::v0::Abs>(C), ParameterVector{A});
|
||||
auto optimized_f = baseline_f->clone();
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ov::pass::NopElimination>();
|
||||
manager.run_passes(optimized_f);
|
||||
@@ -860,8 +859,8 @@ TEST(nop_elimination, gather_3d_indices_constant_axis_1) {
|
||||
}
|
||||
auto G = make_shared<op::v1::Gather>((multiout ? A1->output(0) : A1), indices, axis);
|
||||
|
||||
auto baseline_f = make_shared<Function>(make_shared<op::v0::Abs>(G), ParameterVector{A});
|
||||
auto optimized_f = clone_function(*baseline_f);
|
||||
auto baseline_f = make_shared<ov::Model>(make_shared<op::v0::Abs>(G), ParameterVector{A});
|
||||
auto optimized_f = baseline_f->clone();
|
||||
|
||||
pass::Manager pass_manager;
|
||||
pass_manager.register_pass<ov::pass::Validate>();
|
||||
@@ -1049,13 +1048,13 @@ TEST_P(EliminateEltwiseTests, eliminate_eltwise) {
|
||||
ASSERT_FALSE(true) << "Invalid OpType";
|
||||
}
|
||||
auto abs = make_shared<opset8::Abs>(node);
|
||||
function = make_shared<Function>(abs, ParameterVector{parameter});
|
||||
function = make_shared<ov::Model>(abs, ParameterVector{parameter});
|
||||
|
||||
manager.register_pass<ov::pass::NopElimination>();
|
||||
|
||||
if (can_fuse) {
|
||||
auto abs = make_shared<opset8::Abs>(parameter);
|
||||
function_ref = make_shared<Function>(abs, ParameterVector{parameter});
|
||||
function_ref = make_shared<ov::Model>(abs, ParameterVector{parameter});
|
||||
}
|
||||
|
||||
comparator.enable(FunctionsComparator::CmpValues::CONST_VALUES);
|
||||
@@ -1131,13 +1130,13 @@ TEST_F(TransformationTestsF, eliminate_eltwise_dequantization_subgraph) {
|
||||
auto convert = make_shared<opset8::Convert>(constant, element::f32);
|
||||
auto sub = make_shared<opset8::Subtract>(convert, opset8::Constant::create(element::f32, Shape{}, {0}));
|
||||
auto mul = make_shared<opset8::Multiply>(sub, opset8::Constant::create(element::f32, Shape{}, {1}));
|
||||
function = make_shared<Function>(mul, ParameterVector{});
|
||||
function = make_shared<ov::Model>(mul, ParameterVector{});
|
||||
}
|
||||
{
|
||||
auto constant = opset8::Constant::create(element::i8, Shape{}, {2});
|
||||
auto convert = make_shared<opset8::Convert>(constant, element::f32);
|
||||
auto mul = make_shared<opset8::Multiply>(convert, opset8::Constant::create(element::f32, Shape{}, {1}));
|
||||
function_ref = make_shared<Function>(mul, ParameterVector{});
|
||||
function_ref = make_shared<ov::Model>(mul, ParameterVector{});
|
||||
}
|
||||
|
||||
manager.register_pass<ov::pass::NopElimination>();
|
||||
@@ -1320,7 +1319,7 @@ TEST(nop_elimination, gather_to_squeeze) {
|
||||
auto indices = op::Constant::create(element::i64, Shape{}, vector<int64_t>{0});
|
||||
auto axis = op::Constant::create(element::i64, Shape{}, vector<int64_t>{gather_axis});
|
||||
auto gather = std::make_shared<op::v8::Gather>(arg, indices, axis);
|
||||
return std::make_shared<Function>(NodeVector{gather}, ParameterVector{arg});
|
||||
return std::make_shared<ov::Model>(NodeVector{gather}, ParameterVector{arg});
|
||||
};
|
||||
|
||||
auto func_axis_0 = generate_func(0);
|
||||
@@ -1329,7 +1328,7 @@ TEST(nop_elimination, gather_to_squeeze) {
|
||||
auto func_axis_3 = generate_func(3);
|
||||
pass::Manager pass_manager;
|
||||
pass_manager.register_pass<ov::pass::NopElimination>();
|
||||
auto run_and_check = [&](std::shared_ptr<Function>& func) {
|
||||
auto run_and_check = [&](std::shared_ptr<ov::Model>& func) {
|
||||
pass_manager.run_passes(func);
|
||||
EXPECT_EQ(count_ops_of_type<op::v8::Gather>(func), 0);
|
||||
EXPECT_EQ(count_ops_of_type<op::v0::Squeeze>(func), 1);
|
||||
|
||||
+15
-15
@@ -691,10 +691,10 @@ TEST_F(TransformationTestsF, RICFusionSplitConcatDetectionNegative3) {
|
||||
|
||||
TEST_F(TransformationTestsF, FuseConvertLayout) {
|
||||
{
|
||||
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 64});
|
||||
auto order = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {1, 2, 0});
|
||||
auto transpose = std::make_shared<ngraph::opset6::Transpose>(input, order);
|
||||
auto relu = std::make_shared<ngraph::opset6::Relu>(transpose);
|
||||
auto input = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 64});
|
||||
auto order = ov::op::v0::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {1, 2, 0});
|
||||
auto transpose = std::make_shared<ov::op::v1::Transpose>(input, order);
|
||||
auto relu = std::make_shared<ov::op::v0::Relu>(transpose);
|
||||
|
||||
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{relu}, ngraph::ParameterVector{input});
|
||||
|
||||
@@ -708,9 +708,9 @@ TEST_F(TransformationTestsF, FuseConvertLayout) {
|
||||
}
|
||||
|
||||
{
|
||||
auto input = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f16, ngraph::Shape{3, 64, 1});
|
||||
auto convert = std::make_shared<ngraph::opset6::Convert>(input, element::f32);
|
||||
auto relu = std::make_shared<ngraph::opset6::Relu>(convert);
|
||||
auto input = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f16, ngraph::Shape{3, 64, 1});
|
||||
auto convert = std::make_shared<ov::op::v0::Convert>(input, element::f32);
|
||||
auto relu = std::make_shared<ov::op::v0::Relu>(convert);
|
||||
|
||||
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{relu}, ngraph::ParameterVector{input});
|
||||
}
|
||||
@@ -719,8 +719,8 @@ TEST_F(TransformationTestsF, FuseConvertLayout) {
|
||||
TEST_F(TransformationTestsF, FuseScaleValue) {
|
||||
{
|
||||
auto input = create_param({1, 64, 64, 3});
|
||||
auto order = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {0, 3, 1, 2});
|
||||
auto transpose = std::make_shared<ngraph::opset6::Transpose>(input, order);
|
||||
auto order = ov::op::v0::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {0, 3, 1, 2});
|
||||
auto transpose = std::make_shared<ov::op::v1::Transpose>(input, order);
|
||||
auto conv = create_conv(transpose, {6, 3, 3, 3});
|
||||
|
||||
function = std::make_shared<Function>(NodeVector{conv}, ParameterVector{input});
|
||||
@@ -736,8 +736,8 @@ TEST_F(TransformationTestsF, FuseScaleValue) {
|
||||
|
||||
{
|
||||
auto input = create_param({1, 64, 64, 3});
|
||||
auto order = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {0, 3, 1, 2});
|
||||
auto transpose = std::make_shared<ngraph::opset6::Transpose>(input, order);
|
||||
auto order = ov::op::v0::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {0, 3, 1, 2});
|
||||
auto transpose = std::make_shared<ov::op::v1::Transpose>(input, order);
|
||||
auto conv = create_conv(transpose, {6, 3, 3, 3});
|
||||
function_ref = std::make_shared<Function>(NodeVector{conv}, ParameterVector{input});
|
||||
}
|
||||
@@ -748,8 +748,8 @@ TEST_F(TransformationTestsF, FuseScaleValue) {
|
||||
TEST_F(TransformationTestsF, FuseScaleValues) {
|
||||
{
|
||||
auto input = create_param({1, 64, 64, 3});
|
||||
auto order = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {0, 3, 1, 2});
|
||||
auto transpose = std::make_shared<ngraph::opset6::Transpose>(input, order);
|
||||
auto order = ov::op::v0::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {0, 3, 1, 2});
|
||||
auto transpose = std::make_shared<ov::op::v1::Transpose>(input, order);
|
||||
auto conv = create_conv(transpose, {6, 3, 3, 3});
|
||||
|
||||
function = std::make_shared<Function>(NodeVector{conv}, ParameterVector{input});
|
||||
@@ -765,8 +765,8 @@ TEST_F(TransformationTestsF, FuseScaleValues) {
|
||||
|
||||
{
|
||||
auto input = create_param({1, 64, 64, 3});
|
||||
auto order = ngraph::opset6::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {0, 3, 1, 2});
|
||||
auto transpose = std::make_shared<ngraph::opset6::Transpose>(input, order);
|
||||
auto order = ov::op::v0::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {0, 3, 1, 2});
|
||||
auto transpose = std::make_shared<ov::op::v1::Transpose>(input, order);
|
||||
auto conv = create_conv(transpose, {6, 3, 3, 3});
|
||||
function_ref = std::make_shared<Function>(NodeVector{conv}, ParameterVector{input});
|
||||
}
|
||||
|
||||
+3
-3
@@ -64,13 +64,13 @@ public:
|
||||
f_ref = f;
|
||||
}
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
ngraph::pass::Manager manager;
|
||||
auto pass_config = manager.get_pass_config();
|
||||
manager.register_pass<ngraph::pass::InitUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InitNodeInfo>();
|
||||
manager.register_pass<ov::pass::ShuffleChannelsFusion>(values.check_values);
|
||||
manager.register_pass<ngraph::pass::CheckUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
manager.run_passes(f);
|
||||
ASSERT_NO_THROW(check_rt_info(f));
|
||||
}
|
||||
|
||||
+1
-1
@@ -368,7 +368,7 @@ TEST_F(TransformationTestsF, SimplifySecondInputOfReshapeTest14) {
|
||||
{
|
||||
auto data = std::make_shared<opset7::Parameter>(element::f32, data_shape);
|
||||
|
||||
auto shape_of = std::make_shared<opset1::ShapeOf>(data);
|
||||
auto shape_of = std::make_shared<ov::op::v0::ShapeOf>(data);
|
||||
auto gather_op = gather(shape_of, std::vector<int64_t>{0, 1});
|
||||
auto constant = opset7::Constant::create(element::i64, Shape{1}, {768});
|
||||
auto concat = std::make_shared<opset7::Concat>(OutputVector{gather_op, constant}, 0);
|
||||
|
||||
@@ -36,12 +36,12 @@ TEST_P(SoftmaxFusionFixture, SoftmaxFusion) {
|
||||
auto div = std::make_shared<opset6::Divide>(exp, reduce_sum);
|
||||
f = std::make_shared<Function>(NodeVector{div}, ParameterVector{data});
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
pass::Manager m;
|
||||
m.register_pass<pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitNodeInfo>();
|
||||
m.register_pass<ov::pass::SoftmaxFusion>();
|
||||
m.register_pass<pass::CheckUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
m.run_passes(f);
|
||||
ASSERT_NO_THROW(check_rt_info(f));
|
||||
}
|
||||
@@ -81,12 +81,12 @@ TEST_P(SoftmaxFusionSimplePatternFixture, SoftmaxFusionSimplePatternTest) {
|
||||
auto div = std::make_shared<opset6::Divide>(exp, reduce_sum);
|
||||
f = std::make_shared<Function>(NodeVector{div}, ParameterVector{data});
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
pass::Manager m;
|
||||
m.register_pass<pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitNodeInfo>();
|
||||
m.register_pass<ov::pass::SoftmaxFusion>();
|
||||
m.register_pass<pass::CheckUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
m.run_passes(f);
|
||||
ASSERT_NO_THROW(check_rt_info(f));
|
||||
}
|
||||
@@ -136,12 +136,12 @@ TEST_P(NegativeSoftmaxFusionFixture, NegativeSoftmaxFusion) {
|
||||
auto div = std::make_shared<opset6::Divide>(exp, reduce_sum);
|
||||
f = std::make_shared<Function>(NodeVector{div}, ParameterVector{data});
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
pass::Manager m;
|
||||
m.register_pass<pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitNodeInfo>();
|
||||
m.register_pass<ov::pass::SoftmaxFusion>();
|
||||
m.register_pass<pass::CheckUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
m.run_passes(f);
|
||||
ASSERT_NO_THROW(check_rt_info(f));
|
||||
ASSERT_EQ(count_ops_of_type<opset6::ReduceMax>(f), 1);
|
||||
|
||||
@@ -21,41 +21,41 @@ using namespace testing;
|
||||
// Pl->Conv(1x1,1x1)->Conv(1x1,2x2) => Pl->Conv(1x1,2x2)->Conv(1x1,1x1)
|
||||
TEST_F(TransformationTestsF, StridesOptimization1) {
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_2}, ngraph::ParameterVector{data});
|
||||
manager.register_pass<ov::pass::StridesOptimization>();
|
||||
}
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_2}, ngraph::ParameterVector{data});
|
||||
}
|
||||
@@ -64,41 +64,41 @@ TEST_F(TransformationTestsF, StridesOptimization1) {
|
||||
// Pl->Conv(3x3,2x2)->Conv(1x1,2x2) => Pl->Conv(3x3,4x4)->Conv(1x1,1x1)
|
||||
TEST_F(TransformationTestsF, StridesOptimization2) {
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_2}, ngraph::ParameterVector{data});
|
||||
manager.register_pass<ov::pass::StridesOptimization>();
|
||||
}
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{4, 4},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{4, 4},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_2}, ngraph::ParameterVector{data});
|
||||
}
|
||||
@@ -107,41 +107,41 @@ TEST_F(TransformationTestsF, StridesOptimization2) {
|
||||
// Pl->Conv(3x3,2x2)->Conv(3x3,2x2) => Same
|
||||
TEST_F(TransformationTestsF, StridesOptimization3) {
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_2}, ngraph::ParameterVector{data});
|
||||
manager.register_pass<ov::pass::StridesOptimization>();
|
||||
}
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_2}, ngraph::ParameterVector{data});
|
||||
}
|
||||
@@ -151,61 +151,61 @@ TEST_F(TransformationTestsF, StridesOptimization3) {
|
||||
// `-->Conv(3x3,2x2)->ReLU---` `-->Conv(3x3,4x4)->ReLU---`
|
||||
TEST_F(TransformationTestsF, StridesOptimization4) {
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto relu_1 = std::make_shared<ngraph::opset7::Relu>(conv_1);
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto relu_2 = std::make_shared<ngraph::opset7::Relu>(conv_2);
|
||||
auto add = std::make_shared<ngraph::opset7::Add>(relu_1, relu_2);
|
||||
auto weights_3 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ngraph::opset7::Convolution>(add,
|
||||
weights_3,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ov::op::v1::Convolution>(add,
|
||||
weights_3,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_3}, ngraph::ParameterVector{data});
|
||||
manager.register_pass<ov::pass::StridesOptimization>();
|
||||
}
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{4, 4},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{4, 4},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto relu_1 = std::make_shared<ngraph::opset7::Relu>(conv_1);
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_2,
|
||||
ngraph::Strides{4, 4},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_2,
|
||||
ngraph::Strides{4, 4},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto relu_2 = std::make_shared<ngraph::opset7::Relu>(conv_2);
|
||||
auto add = std::make_shared<ngraph::opset7::Add>(relu_1, relu_2);
|
||||
auto weights_3 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ngraph::opset7::Convolution>(add,
|
||||
weights_3,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ov::op::v1::Convolution>(add,
|
||||
weights_3,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_3}, ngraph::ParameterVector{data});
|
||||
}
|
||||
@@ -215,37 +215,37 @@ TEST_F(TransformationTestsF, StridesOptimization4) {
|
||||
// `----------------->ReLU---` `-->Pool(1x1,2x2)->ReLU---`
|
||||
TEST_F(TransformationTestsF, StridesOptimization5) {
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::Strides{});
|
||||
auto relu_1 = std::make_shared<ngraph::opset7::Relu>(conv_1);
|
||||
auto relu_2 = std::make_shared<ngraph::opset7::Relu>(data);
|
||||
auto add = std::make_shared<ngraph::opset7::Add>(relu_1, relu_2);
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(add,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(add,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_2}, ngraph::ParameterVector{data});
|
||||
manager.register_pass<ov::pass::StridesOptimization>();
|
||||
}
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto relu_1 = std::make_shared<ngraph::opset7::Relu>(conv_1);
|
||||
auto pool = std::make_shared<ngraph::opset7::MaxPool>(data,
|
||||
ngraph::Strides{2, 2},
|
||||
@@ -254,13 +254,13 @@ TEST_F(TransformationTestsF, StridesOptimization5) {
|
||||
ngraph::Shape{1, 1});
|
||||
auto relu_2 = std::make_shared<ngraph::opset7::Relu>(pool);
|
||||
auto add = std::make_shared<ngraph::opset7::Add>(relu_1, relu_2);
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(add,
|
||||
weights_2,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(add,
|
||||
weights_2,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_2}, ngraph::ParameterVector{data});
|
||||
}
|
||||
@@ -271,69 +271,69 @@ TEST_F(TransformationTestsF, StridesOptimization5) {
|
||||
// Pl->Conv(1x1,2x2)->Conv(1x1,1x1)->Conv(3x3,2x2)->Conv(1x1,1x1)
|
||||
TEST_F(TransformationTestsF, StridesOptimization6) {
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_3 = std::make_shared<ngraph::opset7::Convolution>(conv_2,
|
||||
weights_3,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_4 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_4 = std::make_shared<ngraph::opset7::Convolution>(conv_3,
|
||||
weights_4,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_3 = std::make_shared<ov::op::v1::Convolution>(conv_2,
|
||||
weights_3,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_4 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_4 = std::make_shared<ov::op::v1::Convolution>(conv_3,
|
||||
weights_4,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_4}, ngraph::ParameterVector{data});
|
||||
manager.register_pass<ov::pass::StridesOptimization>();
|
||||
}
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_3 = std::make_shared<ngraph::opset7::Convolution>(conv_2,
|
||||
weights_3,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_4 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_4 = std::make_shared<ngraph::opset7::Convolution>(conv_3,
|
||||
weights_4,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 3, 3}, {128});
|
||||
auto conv_3 = std::make_shared<ov::op::v1::Convolution>(conv_2,
|
||||
weights_3,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_4 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_4 = std::make_shared<ov::op::v1::Convolution>(conv_3,
|
||||
weights_4,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_4}, ngraph::ParameterVector{data});
|
||||
}
|
||||
@@ -346,77 +346,77 @@ TEST_F(TransformationTestsF, StridesOptimization6) {
|
||||
// `--> Pool(1x1, 2x2) -> Relu --> Conv(1x1,1x1)
|
||||
TEST_F(TransformationTestsF, StridesOptimization7) {
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ngraph::opset7::Convolution>(conv_2,
|
||||
weights_3,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ov::op::v1::Convolution>(conv_2,
|
||||
weights_3,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto relu = std::make_shared<ngraph::opset7::Relu>(conv_1);
|
||||
auto weights_4 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_4 = std::make_shared<ngraph::opset7::Convolution>(relu,
|
||||
weights_4,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_4 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_4 = std::make_shared<ov::op::v1::Convolution>(relu,
|
||||
weights_4,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function =
|
||||
std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_3, conv_4}, ngraph::ParameterVector{data});
|
||||
manager.register_pass<ov::pass::StridesOptimization>();
|
||||
}
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{4, 4},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ngraph::opset7::Convolution>(conv_2,
|
||||
weights_3,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(conv_1,
|
||||
weights_2,
|
||||
ngraph::Strides{4, 4},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ov::op::v1::Convolution>(conv_2,
|
||||
weights_3,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto pool = std::make_shared<ngraph::opset7::MaxPool>(conv_1,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::Shape{0, 0},
|
||||
ngraph::Shape{0, 0},
|
||||
ngraph::Shape{1, 1});
|
||||
auto relu = std::make_shared<ngraph::opset7::Relu>(pool);
|
||||
auto weights_4 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_4 = std::make_shared<ngraph::opset7::Convolution>(relu,
|
||||
weights_4,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_4 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_4 = std::make_shared<ov::op::v1::Convolution>(relu,
|
||||
weights_4,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function_ref =
|
||||
std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_3, conv_4}, ngraph::ParameterVector{data});
|
||||
@@ -430,64 +430,64 @@ TEST_F(TransformationTestsF, StridesOptimization7) {
|
||||
// Const-->MaxPool(1x1,4x4)-->Squeeze` Pl--->MaxPool(1x1,2x2)-->Squeeze`
|
||||
TEST_F(TransformationTestsF, StridesOptimization8) {
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::Strides{});
|
||||
auto relu_1 = std::make_shared<ngraph::opset7::Relu>(conv_1);
|
||||
ngraph::Shape const_shape{1, 3, 224, 224};
|
||||
auto constant = ngraph::opset7::Constant::create(ngraph::element::f32,
|
||||
const_shape,
|
||||
std::vector<float>(shape_size(const_shape), 1));
|
||||
auto add = std::make_shared<ngraph::opset7::Add>(relu_1, constant);
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(add,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data_2 = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{3, 112, 112});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(add,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{3, 112, 112});
|
||||
auto add_2 = std::make_shared<ngraph::opset7::Add>(conv_2, data_2);
|
||||
auto weights_3 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ngraph::opset7::Convolution>(add_2,
|
||||
weights_3,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ov::op::v1::Convolution>(add_2,
|
||||
weights_3,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function =
|
||||
std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_3}, ngraph::ParameterVector{data, data_2});
|
||||
manager.register_pass<ov::pass::StridesOptimization>();
|
||||
}
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{4, 4},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{4, 4},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto relu_1 = std::make_shared<ngraph::opset7::Relu>(conv_1);
|
||||
ngraph::Shape const_shape{1, 3, 56, 56};
|
||||
auto constant = ngraph::opset7::Constant::create(ngraph::element::f32,
|
||||
const_shape,
|
||||
std::vector<float>(shape_size(const_shape), 1));
|
||||
auto add = std::make_shared<ngraph::opset7::Add>(relu_1, constant);
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(add,
|
||||
weights_2,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data_2 = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{3, 112, 112});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(add,
|
||||
weights_2,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{3, 112, 112});
|
||||
auto reshape = std::make_shared<ngraph::opset7::Reshape>(
|
||||
data_2,
|
||||
ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {1, 3, 112, 112}),
|
||||
@@ -501,13 +501,13 @@ TEST_F(TransformationTestsF, StridesOptimization8) {
|
||||
pool_2,
|
||||
ngraph::op::Constant::create(ngraph::element::u64, ngraph::Shape{1}, {0}));
|
||||
auto add_2 = std::make_shared<ngraph::opset7::Add>(conv_2, squeeze);
|
||||
auto weights_3 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ngraph::opset7::Convolution>(add_2,
|
||||
weights_3,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ov::op::v1::Convolution>(add_2,
|
||||
weights_3,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function_ref =
|
||||
std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_3}, ngraph::ParameterVector{data, data_2});
|
||||
@@ -523,59 +523,59 @@ TEST_F(TransformationTestsF, StridesOptimization8) {
|
||||
// Const--` Const-` Const--` Const-`
|
||||
TEST_F(TransformationTestsF, StridesOptimization9) {
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::Strides{});
|
||||
|
||||
auto data_2 = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{224});
|
||||
auto add_const = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{224}, {128});
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{224});
|
||||
auto add_const = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{224}, {128});
|
||||
auto add = std::make_shared<ngraph::opset7::Add>(data_2, add_const);
|
||||
auto add_2_const = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{224}, {128});
|
||||
auto add_2_const = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{224}, {128});
|
||||
auto add_2 = std::make_shared<ngraph::opset7::Add>(add, add_2_const);
|
||||
|
||||
auto add_3 = std::make_shared<ngraph::opset7::Add>(conv_1, add_2);
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(add_3,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(add_3,
|
||||
weights_2,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
auto data_3 = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{});
|
||||
auto add_4_const = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{}, {128});
|
||||
auto data_3 = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{});
|
||||
auto add_4_const = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{}, {128});
|
||||
auto add_4 = std::make_shared<ngraph::opset7::Add>(data_3, add_4_const);
|
||||
auto add_5_const = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {128});
|
||||
auto add_5_const = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {128});
|
||||
auto add_5 = std::make_shared<ngraph::opset7::Add>(add_4, add_5_const);
|
||||
auto add_6 = std::make_shared<ngraph::opset7::Add>(conv_2, add_5);
|
||||
auto weights_3 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ngraph::opset7::Convolution>(add_6,
|
||||
weights_3,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ov::op::v1::Convolution>(add_6,
|
||||
weights_3,
|
||||
ngraph::Strides{2, 2},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_3},
|
||||
ngraph::ParameterVector{data, data_2, data_3});
|
||||
manager.register_pass<ov::pass::StridesOptimization>();
|
||||
}
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ngraph::opset7::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{4, 4},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::Strides{});
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{1, 3, 224, 224});
|
||||
auto weights_1 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_1 = std::make_shared<ov::op::v1::Convolution>(data,
|
||||
weights_1,
|
||||
ngraph::Strides{4, 4},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::CoordinateDiff{0, 0},
|
||||
ngraph::Strides{});
|
||||
|
||||
auto data_2 = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{224});
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{224});
|
||||
auto reshape = std::make_shared<ngraph::opset7::Reshape>(
|
||||
data_2,
|
||||
ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {1, 1, 1, 224}),
|
||||
@@ -588,22 +588,22 @@ TEST_F(TransformationTestsF, StridesOptimization9) {
|
||||
auto squeeze = std::make_shared<ngraph::opset7::Squeeze>(
|
||||
pool,
|
||||
ngraph::op::Constant::create(ngraph::element::u64, ngraph::Shape{3}, {0, 1, 2}));
|
||||
auto add_const = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{56}, {128});
|
||||
auto add_const = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{56}, {128});
|
||||
auto add = std::make_shared<ngraph::opset7::Add>(squeeze, add_const);
|
||||
auto add_2_const = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{56}, {128});
|
||||
auto add_2_const = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{56}, {128});
|
||||
auto add_2 = std::make_shared<ngraph::opset7::Add>(add, add_2_const);
|
||||
|
||||
auto add_3 = std::make_shared<ngraph::opset7::Add>(conv_1, add_2);
|
||||
auto weights_2 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ngraph::opset7::Convolution>(add_3,
|
||||
weights_2,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_2 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_2 = std::make_shared<ov::op::v1::Convolution>(add_3,
|
||||
weights_2,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
auto data_3 = std::make_shared<ngraph::opset1::Parameter>(ngraph::element::f32, ngraph::Shape{});
|
||||
auto new_shape = ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {1, 1, 1, 1});
|
||||
auto data_3 = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{});
|
||||
auto new_shape = ov::op::v0::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {1, 1, 1, 1});
|
||||
auto reshape_2 = std::make_shared<ngraph::opset7::Reshape>(data_3, new_shape, false);
|
||||
auto pool_2 = std::make_shared<ngraph::opset7::MaxPool>(reshape_2,
|
||||
ngraph::Strides{2, 2},
|
||||
@@ -613,18 +613,18 @@ TEST_F(TransformationTestsF, StridesOptimization9) {
|
||||
auto squeeze_2 = std::make_shared<ngraph::opset7::Squeeze>(
|
||||
pool_2,
|
||||
ngraph::op::Constant::create(ngraph::element::u64, ngraph::Shape{4}, {0, 1, 2, 3}));
|
||||
auto add_4_const = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{}, {128});
|
||||
auto add_4_const = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{}, {128});
|
||||
auto add_4 = std::make_shared<ngraph::opset7::Add>(squeeze_2, add_4_const);
|
||||
auto add_5_const = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {128});
|
||||
auto add_5_const = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {128});
|
||||
auto add_5 = std::make_shared<ngraph::opset7::Add>(add_4, add_5_const);
|
||||
auto add_6 = std::make_shared<ngraph::opset7::Add>(conv_2, add_5);
|
||||
auto weights_3 = ngraph::opset1::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ngraph::opset7::Convolution>(add_6,
|
||||
weights_3,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
auto weights_3 = ov::op::v0::Constant::create(ngraph::element::f32, ngraph::Shape{3, 3, 1, 1}, {128});
|
||||
auto conv_3 = std::make_shared<ov::op::v1::Convolution>(add_6,
|
||||
weights_3,
|
||||
ngraph::Strides{1, 1},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::CoordinateDiff{},
|
||||
ngraph::Strides{});
|
||||
|
||||
function_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{conv_3},
|
||||
ngraph::ParameterVector{data, data_2, data_3});
|
||||
|
||||
+63
-63
@@ -22,25 +22,25 @@ TEST_F(TransformationTestsF, TransposeReshapeEliminationForMatMul) {
|
||||
Shape data_shape_1{10, 2};
|
||||
Shape data_shape_2{10, 2, 25};
|
||||
{
|
||||
auto data_1 = std::make_shared<opset1::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<opset1::Parameter>(element::f32, data_shape_2);
|
||||
auto const_transpose_before = opset1::Constant::create(element::i32, Shape{3}, {1, 2, 0});
|
||||
auto transpose_before = std::make_shared<opset1::Transpose>(data_2, const_transpose_before);
|
||||
auto const_reshape_before = opset1::Constant::create(element::i32, Shape{2}, {2, 250});
|
||||
auto reshape_before = std::make_shared<opset1::Reshape>(transpose_before, const_reshape_before, false);
|
||||
auto matmul = std::make_shared<opset1::MatMul>(data_1, reshape_before);
|
||||
auto const_reshape_after = opset1::Constant::create(element::i32, Shape{3}, {10, 10, 25});
|
||||
auto reshape_after = std::make_shared<opset1::Reshape>(matmul, const_reshape_after, false);
|
||||
auto const_tranpose_after = opset1::Constant::create(element::i32, Shape{3}, {2, 0, 1});
|
||||
auto tranpose_after = std::make_shared<opset1::Transpose>(reshape_after, const_tranpose_after);
|
||||
auto data_1 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_2);
|
||||
auto const_transpose_before = ov::op::v0::Constant::create(element::i32, Shape{3}, {1, 2, 0});
|
||||
auto transpose_before = std::make_shared<ov::op::v1::Transpose>(data_2, const_transpose_before);
|
||||
auto const_reshape_before = ov::op::v0::Constant::create(element::i32, Shape{2}, {2, 250});
|
||||
auto reshape_before = std::make_shared<ov::op::v1::Reshape>(transpose_before, const_reshape_before, false);
|
||||
auto matmul = std::make_shared<ov::op::v0::MatMul>(data_1, reshape_before);
|
||||
auto const_reshape_after = ov::op::v0::Constant::create(element::i32, Shape{3}, {10, 10, 25});
|
||||
auto reshape_after = std::make_shared<ov::op::v1::Reshape>(matmul, const_reshape_after, false);
|
||||
auto const_tranpose_after = ov::op::v0::Constant::create(element::i32, Shape{3}, {2, 0, 1});
|
||||
auto tranpose_after = std::make_shared<ov::op::v1::Transpose>(reshape_after, const_tranpose_after);
|
||||
function = std::make_shared<Function>(NodeVector{tranpose_after}, ParameterVector{data_1, data_2});
|
||||
manager.register_pass<ov::pass::InitNodeInfo>();
|
||||
manager.register_pass<ov::pass::TransposeReshapeEliminationForMatmul>();
|
||||
}
|
||||
{
|
||||
auto data_1 = std::make_shared<opset1::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<opset1::Parameter>(element::f32, data_shape_2);
|
||||
auto matmul = std::make_shared<opset1::MatMul>(data_1, data_2);
|
||||
auto data_1 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_2);
|
||||
auto matmul = std::make_shared<ov::op::v0::MatMul>(data_1, data_2);
|
||||
function_ref = std::make_shared<Function>(NodeVector{matmul}, ParameterVector{data_1, data_2});
|
||||
}
|
||||
}
|
||||
@@ -49,24 +49,24 @@ TEST_F(TransformationTestsF, TransposeReshapeEliminationForMatMul_TransposedA) {
|
||||
Shape data_shape_1{2, 10};
|
||||
Shape data_shape_2{10, 2, 25};
|
||||
{
|
||||
auto data_1 = std::make_shared<opset1::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<opset1::Parameter>(element::f32, data_shape_2);
|
||||
auto const_transpose_before = opset1::Constant::create(element::i32, Shape{3}, {1, 2, 0});
|
||||
auto transpose_before = std::make_shared<opset1::Transpose>(data_2, const_transpose_before);
|
||||
auto const_reshape_before = opset1::Constant::create(element::i32, Shape{2}, {2, 250});
|
||||
auto reshape_before = std::make_shared<opset1::Reshape>(transpose_before, const_reshape_before, false);
|
||||
auto matmul = std::make_shared<opset1::MatMul>(data_1, reshape_before, true, false);
|
||||
auto const_reshape_after = opset1::Constant::create(element::i32, Shape{3}, {10, 10, 25});
|
||||
auto reshape_after = std::make_shared<opset1::Reshape>(matmul, const_reshape_after, false);
|
||||
auto const_tranpose_after = opset1::Constant::create(element::i32, Shape{3}, {2, 0, 1});
|
||||
auto tranpose_after = std::make_shared<opset1::Transpose>(reshape_after, const_tranpose_after);
|
||||
auto data_1 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_2);
|
||||
auto const_transpose_before = ov::op::v0::Constant::create(element::i32, Shape{3}, {1, 2, 0});
|
||||
auto transpose_before = std::make_shared<ov::op::v1::Transpose>(data_2, const_transpose_before);
|
||||
auto const_reshape_before = ov::op::v0::Constant::create(element::i32, Shape{2}, {2, 250});
|
||||
auto reshape_before = std::make_shared<ov::op::v1::Reshape>(transpose_before, const_reshape_before, false);
|
||||
auto matmul = std::make_shared<ov::op::v0::MatMul>(data_1, reshape_before, true, false);
|
||||
auto const_reshape_after = ov::op::v0::Constant::create(element::i32, Shape{3}, {10, 10, 25});
|
||||
auto reshape_after = std::make_shared<ov::op::v1::Reshape>(matmul, const_reshape_after, false);
|
||||
auto const_tranpose_after = ov::op::v0::Constant::create(element::i32, Shape{3}, {2, 0, 1});
|
||||
auto tranpose_after = std::make_shared<ov::op::v1::Transpose>(reshape_after, const_tranpose_after);
|
||||
function = std::make_shared<Function>(NodeVector{tranpose_after}, ParameterVector{data_1, data_2});
|
||||
manager.register_pass<ov::pass::TransposeReshapeEliminationForMatmul>();
|
||||
}
|
||||
{
|
||||
auto data_1 = std::make_shared<opset1::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<opset1::Parameter>(element::f32, data_shape_2);
|
||||
auto matmul = std::make_shared<opset1::MatMul>(data_1, data_2, true, false);
|
||||
auto data_1 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_2);
|
||||
auto matmul = std::make_shared<ov::op::v0::MatMul>(data_1, data_2, true, false);
|
||||
function_ref = std::make_shared<Function>(NodeVector{matmul}, ParameterVector{data_1, data_2});
|
||||
}
|
||||
}
|
||||
@@ -75,24 +75,24 @@ TEST_F(TransformationTestsF, TransposeReshapeEliminationForMatMul_TransposedB) {
|
||||
Shape data_shape_1{10, 2};
|
||||
Shape data_shape_2{10, 2, 25};
|
||||
{
|
||||
auto data_1 = std::make_shared<opset1::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<opset1::Parameter>(element::f32, data_shape_2);
|
||||
auto const_transpose_before = opset1::Constant::create(element::i32, Shape{3}, {0, 2, 1});
|
||||
auto transpose_before = std::make_shared<opset1::Transpose>(data_2, const_transpose_before);
|
||||
auto const_reshape_before = opset1::Constant::create(element::i32, Shape{2}, {250, 2});
|
||||
auto reshape_before = std::make_shared<opset1::Reshape>(transpose_before, const_reshape_before, false);
|
||||
auto matmul = std::make_shared<opset1::MatMul>(data_1, reshape_before, false, true);
|
||||
auto const_reshape_after = opset1::Constant::create(element::i32, Shape{3}, {10, 10, 25});
|
||||
auto reshape_after = std::make_shared<opset1::Reshape>(matmul, const_reshape_after, false);
|
||||
auto const_tranpose_after = opset1::Constant::create(element::i32, Shape{3}, {1, 0, 2});
|
||||
auto tranpose_after = std::make_shared<opset1::Transpose>(reshape_after, const_tranpose_after);
|
||||
auto data_1 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_2);
|
||||
auto const_transpose_before = ov::op::v0::Constant::create(element::i32, Shape{3}, {0, 2, 1});
|
||||
auto transpose_before = std::make_shared<ov::op::v1::Transpose>(data_2, const_transpose_before);
|
||||
auto const_reshape_before = ov::op::v0::Constant::create(element::i32, Shape{2}, {250, 2});
|
||||
auto reshape_before = std::make_shared<ov::op::v1::Reshape>(transpose_before, const_reshape_before, false);
|
||||
auto matmul = std::make_shared<ov::op::v0::MatMul>(data_1, reshape_before, false, true);
|
||||
auto const_reshape_after = ov::op::v0::Constant::create(element::i32, Shape{3}, {10, 10, 25});
|
||||
auto reshape_after = std::make_shared<ov::op::v1::Reshape>(matmul, const_reshape_after, false);
|
||||
auto const_tranpose_after = ov::op::v0::Constant::create(element::i32, Shape{3}, {1, 0, 2});
|
||||
auto tranpose_after = std::make_shared<ov::op::v1::Transpose>(reshape_after, const_tranpose_after);
|
||||
function = std::make_shared<Function>(NodeVector{tranpose_after}, ParameterVector{data_1, data_2});
|
||||
manager.register_pass<ov::pass::TransposeReshapeEliminationForMatmul>();
|
||||
}
|
||||
{
|
||||
auto data_1 = std::make_shared<opset1::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<opset1::Parameter>(element::f32, data_shape_2);
|
||||
auto matmul = std::make_shared<opset1::MatMul>(data_1, data_2);
|
||||
auto data_1 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_2);
|
||||
auto matmul = std::make_shared<ov::op::v0::MatMul>(data_1, data_2);
|
||||
function_ref = std::make_shared<Function>(NodeVector{matmul}, ParameterVector{data_1, data_2});
|
||||
}
|
||||
}
|
||||
@@ -101,24 +101,24 @@ TEST_F(TransformationTestsF, TransposeReshapeEliminationForMatMul_TransposedAB)
|
||||
Shape data_shape_1{2, 10};
|
||||
Shape data_shape_2{10, 2, 25};
|
||||
{
|
||||
auto data_1 = std::make_shared<opset1::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<opset1::Parameter>(element::f32, data_shape_2);
|
||||
auto const_transpose_before = opset1::Constant::create(element::i32, Shape{3}, {0, 2, 1});
|
||||
auto transpose_before = std::make_shared<opset1::Transpose>(data_2, const_transpose_before);
|
||||
auto const_reshape_before = opset1::Constant::create(element::i32, Shape{2}, {250, 2});
|
||||
auto reshape_before = std::make_shared<opset1::Reshape>(transpose_before, const_reshape_before, false);
|
||||
auto matmul = std::make_shared<opset1::MatMul>(data_1, reshape_before, true, true);
|
||||
auto const_reshape_after = opset1::Constant::create(element::i32, Shape{3}, {10, 10, 25});
|
||||
auto reshape_after = std::make_shared<opset1::Reshape>(matmul, const_reshape_after, false);
|
||||
auto const_tranpose_after = opset1::Constant::create(element::i32, Shape{3}, {1, 0, 2});
|
||||
auto tranpose_after = std::make_shared<opset1::Transpose>(reshape_after, const_tranpose_after);
|
||||
auto data_1 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_2);
|
||||
auto const_transpose_before = ov::op::v0::Constant::create(element::i32, Shape{3}, {0, 2, 1});
|
||||
auto transpose_before = std::make_shared<ov::op::v1::Transpose>(data_2, const_transpose_before);
|
||||
auto const_reshape_before = ov::op::v0::Constant::create(element::i32, Shape{2}, {250, 2});
|
||||
auto reshape_before = std::make_shared<ov::op::v1::Reshape>(transpose_before, const_reshape_before, false);
|
||||
auto matmul = std::make_shared<ov::op::v0::MatMul>(data_1, reshape_before, true, true);
|
||||
auto const_reshape_after = ov::op::v0::Constant::create(element::i32, Shape{3}, {10, 10, 25});
|
||||
auto reshape_after = std::make_shared<ov::op::v1::Reshape>(matmul, const_reshape_after, false);
|
||||
auto const_tranpose_after = ov::op::v0::Constant::create(element::i32, Shape{3}, {1, 0, 2});
|
||||
auto tranpose_after = std::make_shared<ov::op::v1::Transpose>(reshape_after, const_tranpose_after);
|
||||
function = std::make_shared<Function>(NodeVector{tranpose_after}, ParameterVector{data_1, data_2});
|
||||
manager.register_pass<ov::pass::TransposeReshapeEliminationForMatmul>();
|
||||
}
|
||||
{
|
||||
auto data_1 = std::make_shared<opset1::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<opset1::Parameter>(element::f32, data_shape_2);
|
||||
auto matmul = std::make_shared<opset1::MatMul>(data_1, data_2, true, false);
|
||||
auto data_1 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_2);
|
||||
auto matmul = std::make_shared<ov::op::v0::MatMul>(data_1, data_2, true, false);
|
||||
function_ref = std::make_shared<Function>(NodeVector{matmul}, ParameterVector{data_1, data_2});
|
||||
}
|
||||
}
|
||||
@@ -127,21 +127,21 @@ TEST_F(TransformationTestsF, TransposeReshapeEliminationForMatMul_Einsum) {
|
||||
Shape data_shape_1{5, 2};
|
||||
Shape data_shape_2{10, 2, 25};
|
||||
{
|
||||
auto data_1 = std::make_shared<opset1::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<opset1::Parameter>(element::f32, data_shape_2);
|
||||
auto data_1 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_2);
|
||||
auto einsum = std::make_shared<opset7::Einsum>(OutputVector{data_1, data_2}, "kl,mlj->mkj");
|
||||
function = std::make_shared<Function>(NodeVector{einsum}, ParameterVector{data_1, data_2});
|
||||
manager.register_pass<ov::pass::EinsumDecomposition>();
|
||||
manager.register_pass<ov::pass::TransposeReshapeEliminationForMatmul>();
|
||||
}
|
||||
{
|
||||
auto data_1 = std::make_shared<opset1::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<opset1::Parameter>(element::f32, data_shape_2);
|
||||
auto data_1 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_1);
|
||||
auto data_2 = std::make_shared<ov::op::v0::Parameter>(element::f32, data_shape_2);
|
||||
// for some cases Reshape may be first input for Matmul
|
||||
auto shape_constant =
|
||||
std::make_shared<opset1::Constant>(element::i64, Shape{data_shape_1.size()}, data_shape_1);
|
||||
auto reshape = std::make_shared<opset1::Reshape>(data_1, shape_constant, false);
|
||||
auto matmul = std::make_shared<opset1::MatMul>(reshape, data_2, false, false);
|
||||
std::make_shared<ov::op::v0::Constant>(element::i64, Shape{data_shape_1.size()}, data_shape_1);
|
||||
auto reshape = std::make_shared<ov::op::v1::Reshape>(data_1, shape_constant, false);
|
||||
auto matmul = std::make_shared<ov::op::v0::MatMul>(reshape, data_2, false, false);
|
||||
function_ref = std::make_shared<Function>(NodeVector{matmul}, ParameterVector{data_1, data_2});
|
||||
}
|
||||
}
|
||||
@@ -96,13 +96,13 @@ public:
|
||||
};
|
||||
|
||||
TEST_P(TransposeSinkingFQ, TransposeFQReduce) {
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ngraph::pass::InitUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InitNodeInfo>();
|
||||
manager.register_pass<ov::pass::TransposeFQReduction>();
|
||||
manager.register_pass<ov::pass::TransposeReduction>();
|
||||
manager.register_pass<ngraph::pass::CheckUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
manager.run_passes(f);
|
||||
ASSERT_NO_THROW(check_rt_info(f));
|
||||
|
||||
@@ -215,12 +215,12 @@ private:
|
||||
};
|
||||
|
||||
TEST_P(TransposeSinking, TransposeReduction) {
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ngraph::pass::InitUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InitNodeInfo>();
|
||||
manager.register_pass<ov::pass::TransposeReduction>();
|
||||
manager.register_pass<ngraph::pass::CheckUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
manager.run_passes(f);
|
||||
ASSERT_NO_THROW(check_rt_info(f));
|
||||
|
||||
|
||||
@@ -107,12 +107,12 @@ private:
|
||||
};
|
||||
|
||||
TEST_P(TransposeToReshapeTests, CompareFunctions) {
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
pass::Manager m;
|
||||
m.register_pass<pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitNodeInfo>();
|
||||
m.register_pass<ov::pass::TransposeToReshape>();
|
||||
m.register_pass<ngraph::pass::CheckUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
m.run_passes(f);
|
||||
f->validate_nodes_and_infer_types();
|
||||
ASSERT_NO_THROW(check_rt_info(f));
|
||||
@@ -207,13 +207,13 @@ TEST(TransformationTests, replace_transpose_with_reshape) {
|
||||
auto baseline_f = make_shared<Function>(transpose1, ParameterVector{param});
|
||||
auto optimized_f = baseline_f->clone();
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
pass::Manager m;
|
||||
m.register_pass<pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitNodeInfo>();
|
||||
m.register_pass<ngraph::pass::Validate>();
|
||||
m.register_pass<ov::pass::Validate>();
|
||||
m.register_pass<ov::pass::TransposeToReshape>();
|
||||
m.register_pass<ngraph::pass::CheckUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
m.run_passes(optimized_f);
|
||||
|
||||
auto ps = baseline_f->get_results()[0]->get_output_partial_shape(0);
|
||||
|
||||
+3
-3
@@ -93,12 +93,12 @@ public:
|
||||
};
|
||||
|
||||
TEST_P(TranslateNewWeightFormatToOldOne, ReshapeMatMul) {
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
ngraph::pass::Manager m;
|
||||
m.register_pass<ngraph::pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitNodeInfo>();
|
||||
m.register_pass<ov::pass::WeightsDequantizeToFakeQuantize>();
|
||||
m.register_pass<ngraph::pass::CheckUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
m.run_passes(f);
|
||||
ASSERT_NO_THROW(check_rt_info(f));
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <memory>
|
||||
#include <openvino/opsets/opset9.hpp>
|
||||
#include <openvino/pass/constant_folding.hpp>
|
||||
#include <openvino/pass/manager.hpp>
|
||||
#include <transformations/common_optimizations/push_constant_to_subgraph.hpp>
|
||||
@@ -13,32 +12,39 @@
|
||||
#include <transformations/init_node_info.hpp>
|
||||
|
||||
#include "common_test_utils/ngraph_test_utils.hpp"
|
||||
#include "openvino/op/add.hpp"
|
||||
#include "openvino/op/if.hpp"
|
||||
#include "openvino/op/logical_not.hpp"
|
||||
#include "openvino/op/multiply.hpp"
|
||||
#include "openvino/op/split.hpp"
|
||||
#include "openvino/op/subtract.hpp"
|
||||
#include "openvino/op/variadic_split.hpp"
|
||||
|
||||
using namespace testing;
|
||||
|
||||
std::shared_ptr<ov::Model> get_then_body() {
|
||||
auto Xt = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Yt = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto add_op = std::make_shared<ov::opset9::Add>(Xt, Yt);
|
||||
auto then_op_result = std::make_shared<ov::opset9::Result>(add_op);
|
||||
auto Xt = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Yt = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto add_op = std::make_shared<ov::op::v1::Add>(Xt, Yt);
|
||||
auto then_op_result = std::make_shared<ov::op::v0::Result>(add_op);
|
||||
auto then_body = std::make_shared<ov::Model>(ov::OutputVector{then_op_result}, ov::ParameterVector{Xt, Yt});
|
||||
return then_body;
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::Model> get_else_body() {
|
||||
auto Xe = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Ye = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto mul_op = std::make_shared<ov::opset9::Multiply>(Xe, Ye);
|
||||
auto else_op_result = std::make_shared<ov::opset9::Result>(mul_op);
|
||||
auto Xe = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Ye = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto mul_op = std::make_shared<ov::op::v1::Multiply>(Xe, Ye);
|
||||
auto else_op_result = std::make_shared<ov::op::v0::Result>(mul_op);
|
||||
auto else_body = std::make_shared<ov::Model>(ov::OutputVector{else_op_result}, ov::ParameterVector{Xe, Ye});
|
||||
return else_body;
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::Model> create_if_model(bool condition) {
|
||||
auto X = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto cond = std::make_shared<ov::opset9::Constant>(ov::element::boolean, ov::Shape{1}, condition);
|
||||
auto if_op = std::make_shared<ov::opset8::If>(cond);
|
||||
auto X = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto cond = std::make_shared<ov::op::v0::Constant>(ov::element::boolean, ov::Shape{1}, condition);
|
||||
auto if_op = std::make_shared<ov::op::v8::If>(cond);
|
||||
const auto& then_body = get_then_body();
|
||||
const auto& else_body = get_else_body();
|
||||
|
||||
@@ -49,7 +55,7 @@ std::shared_ptr<ov::Model> create_if_model(bool condition) {
|
||||
if_op->set_input(X, then_p[0], else_p[0]);
|
||||
if_op->set_input(Y, then_p[1], else_p[1]);
|
||||
if_op->set_output(then_body->get_results()[0], else_body->get_results()[0]);
|
||||
auto if_result = std::make_shared<ov::opset9::Result>(if_op);
|
||||
auto if_result = std::make_shared<ov::op::v0::Result>(if_op);
|
||||
|
||||
return std::make_shared<ov::Model>(ov::NodeVector{if_result}, ov::ParameterVector{X, Y});
|
||||
}
|
||||
@@ -95,12 +101,12 @@ TEST(TransformationTests, UnrollIfCondIsFalse) {
|
||||
TEST(TransformationTests, UnrollIfWithSplitInput) {
|
||||
std::shared_ptr<ov::Model> f(nullptr), f_ref(nullptr);
|
||||
{
|
||||
auto X = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{2, 3});
|
||||
auto Y = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto X = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{2, 3});
|
||||
auto Y = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto split =
|
||||
std::make_shared<ov::opset9::Split>(X, ov::opset9::Constant::create(ov::element::i32, ov::Shape{}, {0}), 2);
|
||||
auto cond = std::make_shared<ov::opset9::Constant>(ov::element::boolean, ov::Shape{1}, false);
|
||||
auto if_op = std::make_shared<ov::opset8::If>(cond);
|
||||
std::make_shared<ov::op::v1::Split>(X, ov::op::v0::Constant::create(ov::element::i32, ov::Shape{}, {0}), 2);
|
||||
auto cond = std::make_shared<ov::op::v0::Constant>(ov::element::boolean, ov::Shape{1}, false);
|
||||
auto if_op = std::make_shared<ov::op::v8::If>(cond);
|
||||
const auto& then_body = get_then_body();
|
||||
const auto& else_body = get_else_body();
|
||||
|
||||
@@ -113,7 +119,7 @@ TEST(TransformationTests, UnrollIfWithSplitInput) {
|
||||
if_op->set_input(split->output(1), nullptr, else_p[0]);
|
||||
if_op->set_input(Y, then_p[1], else_p[1]);
|
||||
if_op->set_output(then_body->get_results()[0], else_body->get_results()[0]);
|
||||
auto if_result = std::make_shared<ov::opset9::Result>(if_op);
|
||||
auto if_result = std::make_shared<ov::op::v0::Result>(if_op);
|
||||
|
||||
f = std::make_shared<ov::Model>(ov::NodeVector{if_result}, ov::ParameterVector{X, Y});
|
||||
|
||||
@@ -126,12 +132,12 @@ TEST(TransformationTests, UnrollIfWithSplitInput) {
|
||||
}
|
||||
|
||||
{
|
||||
auto X = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{2, 3});
|
||||
auto Y = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto X = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{2, 3});
|
||||
auto Y = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto split =
|
||||
std::make_shared<ov::opset9::Split>(X, ov::opset9::Constant::create(ov::element::i32, ov::Shape{}, {0}), 2);
|
||||
auto mul_op = std::make_shared<ov::opset9::Multiply>(split->output(1), Y);
|
||||
auto if_result = std::make_shared<ov::opset9::Result>(mul_op);
|
||||
std::make_shared<ov::op::v1::Split>(X, ov::op::v0::Constant::create(ov::element::i32, ov::Shape{}, {0}), 2);
|
||||
auto mul_op = std::make_shared<ov::op::v1::Multiply>(split->output(1), Y);
|
||||
auto if_result = std::make_shared<ov::op::v0::Result>(mul_op);
|
||||
f_ref = std::make_shared<ov::Model>(ov::NodeVector{if_result}, ov::ParameterVector{X, Y});
|
||||
}
|
||||
|
||||
@@ -142,14 +148,14 @@ TEST(TransformationTests, UnrollIfWithSplitInput) {
|
||||
TEST(TransformationTests, UnrollNestedIfThenBody) {
|
||||
std::shared_ptr<ov::Model> f(nullptr), f_ref(nullptr);
|
||||
{
|
||||
auto X = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto X = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
|
||||
auto then_body = create_if_model(true);
|
||||
auto else_body = create_if_model(false);
|
||||
|
||||
auto cond = std::make_shared<ov::opset9::Constant>(ov::element::boolean, ov::Shape{1}, true);
|
||||
auto if_op = std::make_shared<ov::opset8::If>(cond);
|
||||
auto cond = std::make_shared<ov::op::v0::Constant>(ov::element::boolean, ov::Shape{1}, true);
|
||||
auto if_op = std::make_shared<ov::op::v8::If>(cond);
|
||||
|
||||
if_op->set_then_body(then_body);
|
||||
if_op->set_else_body(else_body);
|
||||
@@ -158,7 +164,7 @@ TEST(TransformationTests, UnrollNestedIfThenBody) {
|
||||
if_op->set_input(X, then_p[0], else_p[0]);
|
||||
if_op->set_input(Y, then_p[1], else_p[1]);
|
||||
if_op->set_output(then_body->get_results()[0], else_body->get_results()[0]);
|
||||
auto if_result = std::make_shared<ov::opset9::Result>(if_op);
|
||||
auto if_result = std::make_shared<ov::op::v0::Result>(if_op);
|
||||
|
||||
f = std::make_shared<ov::Model>(ov::NodeVector{if_result}, ov::ParameterVector{X, Y});
|
||||
ov::pass::Manager manager;
|
||||
@@ -177,20 +183,20 @@ TEST(TransformationTests, UnrollNestedIfThenBody) {
|
||||
TEST(TransformationTests, UnrollIfCondIsTrueMultiOutput) {
|
||||
std::shared_ptr<ngraph::Function> f(nullptr), f_ref(nullptr);
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{3});
|
||||
auto X = std::make_shared<ngraph::opset6::VariadicSplit>(
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{3});
|
||||
auto X = std::make_shared<ov::op::v1::VariadicSplit>(
|
||||
data,
|
||||
ngraph::opset6::Constant::create(ngraph::element::i32, {1}, {0}),
|
||||
ngraph::opset6::Constant::create(ngraph::element::i32, {2}, {1, 2}));
|
||||
auto cond = std::make_shared<ngraph::opset1::Constant>(ngraph::element::boolean, ngraph::Shape{1}, true);
|
||||
auto if_op = std::make_shared<ov::opset9::If>(cond);
|
||||
auto Xt = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{2});
|
||||
auto then_op_result = std::make_shared<ngraph::opset1::Result>(Xt);
|
||||
ov::op::v0::Constant::create(ngraph::element::i32, {1}, {0}),
|
||||
ov::op::v0::Constant::create(ngraph::element::i32, {2}, {1, 2}));
|
||||
auto cond = std::make_shared<ov::op::v0::Constant>(ngraph::element::boolean, ngraph::Shape{1}, true);
|
||||
auto if_op = std::make_shared<ov::op::v8::If>(cond);
|
||||
auto Xt = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{2});
|
||||
auto then_op_result = std::make_shared<ov::op::v0::Result>(Xt);
|
||||
auto then_body =
|
||||
std::make_shared<ngraph::Function>(ngraph::OutputVector{then_op_result}, ngraph::ParameterVector{Xt});
|
||||
|
||||
auto Xe = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{2});
|
||||
auto else_op_result = std::make_shared<ngraph::opset1::Result>(Xe);
|
||||
auto Xe = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{2});
|
||||
auto else_op_result = std::make_shared<ov::op::v0::Result>(Xe);
|
||||
auto else_body =
|
||||
std::make_shared<ngraph::Function>(ngraph::OutputVector{else_op_result}, ngraph::ParameterVector{Xe});
|
||||
|
||||
@@ -198,11 +204,11 @@ TEST(TransformationTests, UnrollIfCondIsTrueMultiOutput) {
|
||||
if_op->set_else_body(else_body);
|
||||
if_op->set_input(X->output(1), Xt, Xe);
|
||||
if_op->set_output(then_op_result, else_op_result);
|
||||
auto if_result = std::make_shared<ngraph::opset1::Result>(if_op);
|
||||
auto if_result = std::make_shared<ov::op::v0::Result>(if_op);
|
||||
|
||||
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{if_result}, ngraph::ParameterVector{data});
|
||||
|
||||
ngraph::pass::Manager manager;
|
||||
ov::pass::Manager manager;
|
||||
manager.register_pass<ov::pass::InitNodeInfo>();
|
||||
manager.register_pass<ov::pass::UnrollIf>();
|
||||
manager.run_passes(f);
|
||||
@@ -211,12 +217,12 @@ TEST(TransformationTests, UnrollIfCondIsTrueMultiOutput) {
|
||||
}
|
||||
|
||||
{
|
||||
auto data = std::make_shared<ngraph::opset6::Parameter>(ngraph::element::f32, ngraph::Shape{3});
|
||||
auto X = std::make_shared<ngraph::opset6::VariadicSplit>(
|
||||
auto data = std::make_shared<ov::op::v0::Parameter>(ngraph::element::f32, ngraph::Shape{3});
|
||||
auto X = std::make_shared<ov::op::v1::VariadicSplit>(
|
||||
data,
|
||||
ngraph::opset6::Constant::create(ngraph::element::i32, {1}, {0}),
|
||||
ngraph::opset6::Constant::create(ngraph::element::i32, {2}, {1, 2}));
|
||||
auto if_result = std::make_shared<ngraph::opset1::Result>(X->output(1));
|
||||
ov::op::v0::Constant::create(ngraph::element::i32, {1}, {0}),
|
||||
ov::op::v0::Constant::create(ngraph::element::i32, {2}, {1, 2}));
|
||||
auto if_result = std::make_shared<ov::op::v0::Result>(X->output(1));
|
||||
f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{if_result}, ngraph::ParameterVector{data});
|
||||
}
|
||||
|
||||
@@ -227,32 +233,32 @@ TEST(TransformationTests, UnrollIfCondIsTrueMultiOutput) {
|
||||
TEST(TransformationTests, UnrollIfInsideIf) {
|
||||
std::shared_ptr<ov::Model> f(nullptr), f_ref(nullptr);
|
||||
{
|
||||
auto cond = std::make_shared<ov::opset9::Constant>(ov::element::boolean, ov::Shape{1}, true);
|
||||
auto not_cond = std::make_shared<ov::opset9::LogicalNot>(cond);
|
||||
auto if_op = std::make_shared<ov::opset8::If>(cond);
|
||||
auto cond = std::make_shared<ov::op::v0::Constant>(ov::element::boolean, ov::Shape{1}, true);
|
||||
auto not_cond = std::make_shared<ov::op::v1::LogicalNot>(cond);
|
||||
auto if_op = std::make_shared<ov::op::v8::If>(cond);
|
||||
|
||||
std::shared_ptr<ov::Model> then_body;
|
||||
{
|
||||
auto cond_inside = std::make_shared<ov::opset9::Parameter>(ov::element::boolean, ov::Shape{1});
|
||||
auto if_inside = std::make_shared<ov::opset8::If>(cond_inside);
|
||||
auto cond_inside = std::make_shared<ov::op::v0::Parameter>(ov::element::boolean, ov::Shape{1});
|
||||
auto if_inside = std::make_shared<ov::op::v8::If>(cond_inside);
|
||||
|
||||
std::shared_ptr<ov::Model> then_body_inside;
|
||||
{
|
||||
auto X = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto add = std::make_shared<ov::opset9::Add>(X, Y);
|
||||
auto X = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto add = std::make_shared<ov::op::v1::Add>(X, Y);
|
||||
then_body_inside = std::make_shared<ov::Model>(add, ov::ParameterVector{X, Y});
|
||||
}
|
||||
std::shared_ptr<ov::Model> else_body_inside;
|
||||
{
|
||||
auto X = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto mul = std::make_shared<ov::opset9::Multiply>(X, Y);
|
||||
auto X = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto mul = std::make_shared<ov::op::v1::Multiply>(X, Y);
|
||||
else_body_inside = std::make_shared<ov::Model>(mul, ov::ParameterVector{X, Y});
|
||||
}
|
||||
|
||||
auto X = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto X = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
if_inside->set_then_body(then_body_inside);
|
||||
if_inside->set_else_body(else_body_inside);
|
||||
auto then_p = then_body_inside->get_parameters();
|
||||
@@ -260,21 +266,21 @@ TEST(TransformationTests, UnrollIfInsideIf) {
|
||||
if_inside->set_input(X, then_p[0], else_p[0]);
|
||||
if_inside->set_input(Y, then_p[1], else_p[1]);
|
||||
if_inside->set_output(then_body_inside->get_results()[0], else_body_inside->get_results()[0]);
|
||||
auto if_result = std::make_shared<ov::opset9::Result>(if_inside);
|
||||
auto if_result = std::make_shared<ov::op::v0::Result>(if_inside);
|
||||
|
||||
then_body = std::make_shared<ov::Model>(if_result, ov::ParameterVector{cond_inside, X, Y});
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::Model> else_body;
|
||||
{
|
||||
auto X = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto sub = std::make_shared<ov::opset9::Subtract>(X, Y);
|
||||
auto X = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto sub = std::make_shared<ov::op::v1::Subtract>(X, Y);
|
||||
else_body = std::make_shared<ov::Model>(sub, ov::ParameterVector{X, Y});
|
||||
}
|
||||
|
||||
auto X = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto X = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
if_op->set_then_body(then_body);
|
||||
if_op->set_else_body(else_body);
|
||||
auto then_p = then_body->get_parameters();
|
||||
@@ -283,7 +289,7 @@ TEST(TransformationTests, UnrollIfInsideIf) {
|
||||
if_op->set_input(X, then_p[1], else_p[0]);
|
||||
if_op->set_input(Y, then_p[2], else_p[1]);
|
||||
if_op->set_output(then_body->get_results()[0], else_body->get_results()[0]);
|
||||
auto if_result = std::make_shared<ov::opset9::Result>(if_op);
|
||||
auto if_result = std::make_shared<ov::op::v0::Result>(if_op);
|
||||
|
||||
f = std::make_shared<ov::Model>(ov::NodeVector{if_result}, ov::ParameterVector{X, Y});
|
||||
ov::pass::Manager manager;
|
||||
@@ -296,9 +302,9 @@ TEST(TransformationTests, UnrollIfInsideIf) {
|
||||
}
|
||||
|
||||
{
|
||||
auto X = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::opset9::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto mul = std::make_shared<ov::opset9::Multiply>(X, Y);
|
||||
auto X = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto Y = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{3});
|
||||
auto mul = std::make_shared<ov::op::v1::Multiply>(X, Y);
|
||||
f_ref = std::make_shared<ov::Model>(mul, ov::ParameterVector{X, Y});
|
||||
}
|
||||
|
||||
|
||||
+30
-30
@@ -24,18 +24,18 @@ using namespace ngraph;
|
||||
|
||||
TEST_F(TransformationTestsF, ConvertPreviousNMSToNMSIEInternal) {
|
||||
{
|
||||
auto boxes = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1000, 4});
|
||||
auto scores = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1, 1000});
|
||||
auto max_output_boxes_per_class = opset1::Constant::create(element::i64, Shape{}, {10});
|
||||
auto iou_threshold = opset1::Constant::create(element::f32, Shape{}, {0.75});
|
||||
auto score_threshold = opset1::Constant::create(element::f32, Shape{}, {0.7});
|
||||
auto nms = std::make_shared<opset1::NonMaxSuppression>(boxes,
|
||||
scores,
|
||||
max_output_boxes_per_class,
|
||||
iou_threshold,
|
||||
score_threshold,
|
||||
op::v1::NonMaxSuppression::BoxEncodingType::CORNER,
|
||||
true);
|
||||
auto boxes = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1000, 4});
|
||||
auto scores = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 1000});
|
||||
auto max_output_boxes_per_class = ov::op::v0::Constant::create(element::i64, Shape{}, {10});
|
||||
auto iou_threshold = ov::op::v0::Constant::create(element::f32, Shape{}, {0.75});
|
||||
auto score_threshold = ov::op::v0::Constant::create(element::f32, Shape{}, {0.7});
|
||||
auto nms = std::make_shared<ov::op::v1::NonMaxSuppression>(boxes,
|
||||
scores,
|
||||
max_output_boxes_per_class,
|
||||
iou_threshold,
|
||||
score_threshold,
|
||||
op::v1::NonMaxSuppression::BoxEncodingType::CORNER,
|
||||
true);
|
||||
|
||||
function = std::make_shared<Function>(NodeVector{nms}, ParameterVector{boxes, scores});
|
||||
|
||||
@@ -49,11 +49,11 @@ TEST_F(TransformationTestsF, ConvertPreviousNMSToNMSIEInternal) {
|
||||
}
|
||||
|
||||
{
|
||||
auto boxes = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1000, 4});
|
||||
auto scores = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1, 1000});
|
||||
auto max_output_boxes_per_class = opset1::Constant::create(element::i64, Shape{1}, {10});
|
||||
auto iou_threshold = opset1::Constant::create(element::f32, Shape{1}, {0.75});
|
||||
auto score_threshold = opset1::Constant::create(element::f32, Shape{1}, {0.7});
|
||||
auto boxes = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1000, 4});
|
||||
auto scores = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 1000});
|
||||
auto max_output_boxes_per_class = ov::op::v0::Constant::create(element::i64, Shape{1}, {10});
|
||||
auto iou_threshold = ov::op::v0::Constant::create(element::f32, Shape{1}, {0.75});
|
||||
auto score_threshold = ov::op::v0::Constant::create(element::f32, Shape{1}, {0.7});
|
||||
auto nms = std::make_shared<ov::op::internal::NonMaxSuppressionIEInternal>(boxes,
|
||||
scores,
|
||||
max_output_boxes_per_class,
|
||||
@@ -62,7 +62,7 @@ TEST_F(TransformationTestsF, ConvertPreviousNMSToNMSIEInternal) {
|
||||
0,
|
||||
true,
|
||||
element::i32);
|
||||
auto convert = std::make_shared<opset1::Convert>(nms->output(0), element::i64);
|
||||
auto convert = std::make_shared<ov::op::v0::Convert>(nms->output(0), element::i64);
|
||||
|
||||
function_ref = std::make_shared<Function>(NodeVector{convert}, ParameterVector{boxes, scores});
|
||||
}
|
||||
@@ -70,12 +70,12 @@ TEST_F(TransformationTestsF, ConvertPreviousNMSToNMSIEInternal) {
|
||||
|
||||
TEST_F(TransformationTestsF, ConvertNMS9ToNMSIEInternal) {
|
||||
{
|
||||
auto boxes = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1000, 4});
|
||||
auto scores = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1, 1000});
|
||||
auto max_output_boxes_per_class = opset1::Constant::create(element::i32, Shape{}, {10});
|
||||
auto iou_threshold = opset1::Constant::create(element::f32, Shape{}, {0.75});
|
||||
auto score_threshold = opset1::Constant::create(element::f32, Shape{}, {0.7});
|
||||
auto soft_nms_sigma = opset1::Constant::create(element::f32, Shape{}, {0.5});
|
||||
auto boxes = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1000, 4});
|
||||
auto scores = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 1000});
|
||||
auto max_output_boxes_per_class = ov::op::v0::Constant::create(element::i32, Shape{}, {10});
|
||||
auto iou_threshold = ov::op::v0::Constant::create(element::f32, Shape{}, {0.75});
|
||||
auto score_threshold = ov::op::v0::Constant::create(element::f32, Shape{}, {0.7});
|
||||
auto soft_nms_sigma = ov::op::v0::Constant::create(element::f32, Shape{}, {0.5});
|
||||
auto nms = std::make_shared<opset9::NonMaxSuppression>(boxes,
|
||||
scores,
|
||||
max_output_boxes_per_class,
|
||||
@@ -93,12 +93,12 @@ TEST_F(TransformationTestsF, ConvertNMS9ToNMSIEInternal) {
|
||||
}
|
||||
|
||||
{
|
||||
auto boxes = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1000, 4});
|
||||
auto scores = std::make_shared<opset1::Parameter>(element::f32, Shape{1, 1, 1000});
|
||||
auto max_output_boxes_per_class = opset1::Constant::create(element::i32, Shape{1}, {10});
|
||||
auto iou_threshold = opset1::Constant::create(element::f32, Shape{1}, {0.75});
|
||||
auto score_threshold = opset1::Constant::create(element::f32, Shape{1}, {0.7});
|
||||
auto soft_nms_sigma = opset1::Constant::create(element::f32, Shape{1}, {0.5});
|
||||
auto boxes = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1000, 4});
|
||||
auto scores = std::make_shared<ov::op::v0::Parameter>(element::f32, Shape{1, 1, 1000});
|
||||
auto max_output_boxes_per_class = ov::op::v0::Constant::create(element::i32, Shape{1}, {10});
|
||||
auto iou_threshold = ov::op::v0::Constant::create(element::f32, Shape{1}, {0.75});
|
||||
auto score_threshold = ov::op::v0::Constant::create(element::f32, Shape{1}, {0.7});
|
||||
auto soft_nms_sigma = ov::op::v0::Constant::create(element::f32, Shape{1}, {0.5});
|
||||
auto nms = std::make_shared<ov::op::internal::NonMaxSuppressionIEInternal>(boxes,
|
||||
scores,
|
||||
max_output_boxes_per_class,
|
||||
|
||||
@@ -135,12 +135,12 @@ public:
|
||||
};
|
||||
|
||||
TEST_P(ConvertReduceToPoolingTests, CompareFunctions) {
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
ngraph::pass::Manager m;
|
||||
m.register_pass<ngraph::pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitNodeInfo>();
|
||||
m.register_pass<ov::pass::ConvertReduceToPooling>();
|
||||
m.register_pass<ngraph::pass::CheckUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
m.run_passes(f);
|
||||
ASSERT_NO_THROW(check_rt_info(f));
|
||||
|
||||
|
||||
+4
-4
@@ -81,13 +81,13 @@ std::shared_ptr<ngraph::Function> get_reference_function(const ngraph::PartialSh
|
||||
}
|
||||
|
||||
void test(std::shared_ptr<ngraph::Function> f, std::shared_ptr<ngraph::Function> f_ref) {
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
ngraph::pass::Manager manager;
|
||||
manager.register_pass<ngraph::pass::InitUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InitNodeInfo>();
|
||||
manager.register_pass<ov::pass::ConvertScatterElementsToScatter>();
|
||||
manager.register_pass<ngraph::pass::CheckUniqueNames>(unh);
|
||||
manager.register_pass<ngraph::pass::InjectionPass>([](std::shared_ptr<ngraph::Function> f) {
|
||||
manager.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
manager.register_pass<ov::pass::InjectionPass>([](std::shared_ptr<ngraph::Function> f) {
|
||||
check_rt_info(f);
|
||||
});
|
||||
manager.register_pass<ngraph::pass::ConstantFolding>();
|
||||
|
||||
+12
-12
@@ -43,7 +43,7 @@ TEST(TransformationTests, TestDepthToSpaceTransformBlockFirst) {
|
||||
ASSERT_EQ(consumers.size(), 1);
|
||||
|
||||
auto reshape_begin = consumers.begin()->get_node();
|
||||
auto shape_begin = std::dynamic_pointer_cast<ngraph::op::Constant>(
|
||||
auto shape_begin = std::dynamic_pointer_cast<ov::op::v0::Constant>(
|
||||
reshape_begin->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::vector<int64_t> shape_begin_value = shape_begin->get_vector<int64_t>();
|
||||
std::vector<int64_t> shape_begin_value_ref{1, 2, 2, 3, 1080, 1616};
|
||||
@@ -54,14 +54,14 @@ TEST(TransformationTests, TestDepthToSpaceTransformBlockFirst) {
|
||||
|
||||
auto transpose = consumers.begin()->get_node();
|
||||
auto order =
|
||||
std::dynamic_pointer_cast<ngraph::op::Constant>(transpose->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::dynamic_pointer_cast<ov::op::v0::Constant>(transpose->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::vector<int64_t> order_value = order->get_vector<int64_t>();
|
||||
std::vector<int64_t> order_value_ref{0, 3, 4, 1, 5, 2};
|
||||
ASSERT_EQ(order_value, order_value_ref);
|
||||
|
||||
consumers = transpose->output(0).get_target_inputs();
|
||||
auto reshape_end = consumers.begin()->get_node();
|
||||
auto shape_end = std::dynamic_pointer_cast<ngraph::op::Constant>(
|
||||
auto shape_end = std::dynamic_pointer_cast<ov::op::v0::Constant>(
|
||||
reshape_end->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::vector<int64_t> shape_end_value = shape_end->get_vector<int64_t>();
|
||||
std::vector<int64_t> shape_end_value_ref{1, 3, 2 * 1080, 2 * 1616};
|
||||
@@ -89,7 +89,7 @@ TEST(TransformationTests, TestDepthToSpaceTransformDepthFirst) {
|
||||
ASSERT_EQ(consumers.size(), 1);
|
||||
|
||||
auto reshape_begin = consumers.begin()->get_node();
|
||||
auto shape_begin = std::dynamic_pointer_cast<ngraph::op::Constant>(
|
||||
auto shape_begin = std::dynamic_pointer_cast<ov::op::v0::Constant>(
|
||||
reshape_begin->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::vector<int64_t> shape_begin_value = shape_begin->get_vector<int64_t>();
|
||||
std::vector<int64_t> shape_begin_value_ref{1, 3, 2, 2, 1080, 1616};
|
||||
@@ -100,14 +100,14 @@ TEST(TransformationTests, TestDepthToSpaceTransformDepthFirst) {
|
||||
|
||||
auto transpose = consumers.begin()->get_node();
|
||||
auto order =
|
||||
std::dynamic_pointer_cast<ngraph::op::Constant>(transpose->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::dynamic_pointer_cast<ov::op::v0::Constant>(transpose->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::vector<int64_t> order_value = order->get_vector<int64_t>();
|
||||
std::vector<int64_t> order_value_ref{0, 1, 4, 2, 5, 3};
|
||||
ASSERT_EQ(order_value, order_value_ref);
|
||||
|
||||
consumers = transpose->output(0).get_target_inputs();
|
||||
auto reshape_end = consumers.begin()->get_node();
|
||||
auto shape_end = std::dynamic_pointer_cast<ngraph::op::Constant>(
|
||||
auto shape_end = std::dynamic_pointer_cast<ov::op::v0::Constant>(
|
||||
reshape_end->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::vector<int64_t> shape_end_value = shape_end->get_vector<int64_t>();
|
||||
std::vector<int64_t> shape_end_value_ref{1, 3, 2 * 1080, 2 * 1616};
|
||||
@@ -135,7 +135,7 @@ TEST(TransformationTests, TestSpaceToDepthTransformBlockFirst) {
|
||||
ASSERT_EQ(consumers.size(), 1);
|
||||
|
||||
auto reshape_begin = consumers.begin()->get_node();
|
||||
auto shape_begin = std::dynamic_pointer_cast<ngraph::op::Constant>(
|
||||
auto shape_begin = std::dynamic_pointer_cast<ov::op::v0::Constant>(
|
||||
reshape_begin->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::vector<int64_t> shape_begin_value = shape_begin->get_vector<int64_t>();
|
||||
std::vector<int64_t> shape_begin_value_ref{1, 12, 1080 / 2, 2, 1616 / 2, 2};
|
||||
@@ -146,14 +146,14 @@ TEST(TransformationTests, TestSpaceToDepthTransformBlockFirst) {
|
||||
|
||||
auto transpose = consumers.begin()->get_node();
|
||||
auto order =
|
||||
std::dynamic_pointer_cast<ngraph::op::Constant>(transpose->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::dynamic_pointer_cast<ov::op::v0::Constant>(transpose->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::vector<int64_t> order_value = order->get_vector<int64_t>();
|
||||
std::vector<int64_t> order_value_ref{0, 3, 5, 1, 2, 4};
|
||||
ASSERT_EQ(order_value, order_value_ref);
|
||||
|
||||
consumers = transpose->output(0).get_target_inputs();
|
||||
auto reshape_end = consumers.begin()->get_node();
|
||||
auto shape_end = std::dynamic_pointer_cast<ngraph::op::Constant>(
|
||||
auto shape_end = std::dynamic_pointer_cast<ov::op::v0::Constant>(
|
||||
reshape_end->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::vector<int64_t> shape_end_value = shape_end->get_vector<int64_t>();
|
||||
std::vector<int64_t> shape_end_value_ref{1, 12 * 4, 1080 / 2, 1616 / 2};
|
||||
@@ -181,7 +181,7 @@ TEST(TransformationTests, TestSpaceToDepthTransformDepthFirst) {
|
||||
ASSERT_EQ(consumers.size(), 1);
|
||||
|
||||
auto reshape_begin = consumers.begin()->get_node();
|
||||
auto shape_begin = std::dynamic_pointer_cast<ngraph::op::Constant>(
|
||||
auto shape_begin = std::dynamic_pointer_cast<ov::op::v0::Constant>(
|
||||
reshape_begin->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::vector<int64_t> shape_begin_value = shape_begin->get_vector<int64_t>();
|
||||
std::vector<int64_t> shape_begin_value_ref{1, 12, 1080 / 2, 2, 1616 / 2, 2};
|
||||
@@ -192,14 +192,14 @@ TEST(TransformationTests, TestSpaceToDepthTransformDepthFirst) {
|
||||
|
||||
auto transpose = consumers.begin()->get_node();
|
||||
auto order =
|
||||
std::dynamic_pointer_cast<ngraph::op::Constant>(transpose->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::dynamic_pointer_cast<ov::op::v0::Constant>(transpose->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::vector<int64_t> order_value = order->get_vector<int64_t>();
|
||||
std::vector<int64_t> order_value_ref{0, 1, 3, 5, 2, 4};
|
||||
ASSERT_EQ(order_value, order_value_ref);
|
||||
|
||||
consumers = transpose->output(0).get_target_inputs();
|
||||
auto reshape_end = consumers.begin()->get_node();
|
||||
auto shape_end = std::dynamic_pointer_cast<ngraph::op::Constant>(
|
||||
auto shape_end = std::dynamic_pointer_cast<ov::op::v0::Constant>(
|
||||
reshape_end->input(1).get_source_output().get_node_shared_ptr());
|
||||
std::vector<int64_t> shape_end_value = shape_end->get_vector<int64_t>();
|
||||
std::vector<int64_t> shape_end_value_ref{1, 12 * 4, 1080 / 2, 1616 / 2};
|
||||
|
||||
@@ -31,12 +31,12 @@ TEST(TransformationTests, ModDecompositionTests) {
|
||||
auto mod = std::make_shared<ngraph::op::v1::Mod>(data1, data2);
|
||||
|
||||
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{mod}, ngraph::ParameterVector{});
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
ngraph::pass::Manager m;
|
||||
m.register_pass<ngraph::pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::InitNodeInfo>();
|
||||
m.register_pass<ov::pass::ConvertMod>();
|
||||
m.register_pass<ngraph::pass::CheckUniqueNames>(unh);
|
||||
m.register_pass<ov::pass::CheckUniqueNames>(unh);
|
||||
m.run_passes(f);
|
||||
ASSERT_NO_THROW(check_rt_info(f));
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ TEST(SmartReshapeTests, MimickingSBS) {
|
||||
|
||||
InferenceEngine::CNNNetwork network(f);
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.setBatchSize(2));
|
||||
check_unique_names(f, unh);
|
||||
@@ -45,7 +45,7 @@ TEST(SmartReshapeTests, MimickingSBS_1) {
|
||||
|
||||
InferenceEngine::CNNNetwork network(f);
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.setBatchSize(2));
|
||||
check_unique_names(f, unh);
|
||||
@@ -67,7 +67,7 @@ TEST(SmartReshapeTests, MimickingSBS_2) {
|
||||
|
||||
InferenceEngine::CNNNetwork network(f);
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.setBatchSize(1));
|
||||
check_unique_names(f, unh);
|
||||
|
||||
@@ -42,7 +42,7 @@ TEST(SmartReshapeTests, Proposal1Scales) {
|
||||
}
|
||||
|
||||
InferenceEngine::CNNNetwork network(f);
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.setBatchSize(2));
|
||||
check_unique_names(f, unh);
|
||||
@@ -81,7 +81,7 @@ TEST(SmartReshapeTests, Proposal1Scales_WithConvert) {
|
||||
}
|
||||
|
||||
InferenceEngine::CNNNetwork network(f);
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.setBatchSize(2));
|
||||
check_unique_names(f, unh);
|
||||
@@ -120,7 +120,7 @@ TEST(SmartReshapeTests, Proposal4Scales) {
|
||||
|
||||
InferenceEngine::CNNNetwork network(f);
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.setBatchSize(2));
|
||||
check_unique_names(f, unh);
|
||||
@@ -161,7 +161,7 @@ TEST(SmartReshapeTests, Proposal4Scales_WithConvert) {
|
||||
|
||||
InferenceEngine::CNNNetwork network(f);
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.setBatchSize(2));
|
||||
check_unique_names(f, unh);
|
||||
|
||||
@@ -27,7 +27,7 @@ TEST(SmartReshapeTests, Reshape1d) {
|
||||
ngraph::PartialShape::dynamic()));
|
||||
ASSERT_TRUE(network.getFunction()->get_parameters()[0]->get_partial_shape().compatible({5}));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.reshape(
|
||||
InferenceEngine::ICNNNetwork::InputShapes{{f->get_parameters()[0]->get_friendly_name(), {1, 3, 300, 300}}}));
|
||||
@@ -52,7 +52,7 @@ TEST(SmartReshapeTests, Reshape1d_negative) {
|
||||
ngraph::PartialShape::dynamic()));
|
||||
ASSERT_TRUE(network.getFunction()->get_parameters()[0]->get_partial_shape().is_dynamic());
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.reshape(
|
||||
InferenceEngine::ICNNNetwork::InputShapes{{f->get_parameters()[0]->get_friendly_name(), {1, 3, 300, 300}}}));
|
||||
|
||||
@@ -34,7 +34,7 @@ TEST(SmartReshapeTests, SS_Squeeze) {
|
||||
<< network.getFunction()->get_results()[0]->get_output_partial_shape(0);
|
||||
ASSERT_TRUE(network.getFunction()->get_parameters()[0]->get_partial_shape().compatible({1, 3}));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.setBatchSize(2));
|
||||
check_unique_names(f, unh);
|
||||
@@ -69,7 +69,7 @@ TEST(SmartReshapeTests, SS_Squeeze_partial_begin_end_mask) {
|
||||
<< network.getFunction()->get_results()[0]->get_output_partial_shape(0);
|
||||
ASSERT_TRUE(network.getFunction()->get_parameters()[0]->get_partial_shape().compatible({1, 128, 768}));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
auto inputname = network.getFunction()->get_parameters()[0]->get_friendly_name();
|
||||
ASSERT_NO_THROW(network.reshape(InferenceEngine::ICNNNetwork::InputShapes{{inputname, {2, 128, 768}}}));
|
||||
@@ -107,7 +107,7 @@ TEST(SmartReshapeTests, SS_Squeeze_partial_begin_end) {
|
||||
<< network.getFunction()->get_results()[0]->get_output_partial_shape(0);
|
||||
ASSERT_TRUE(network.getFunction()->get_parameters()[0]->get_partial_shape().compatible({1, 1, 768}));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
auto inputname = network.getFunction()->get_parameters()[0]->get_friendly_name();
|
||||
ASSERT_NO_THROW(network.reshape(InferenceEngine::ICNNNetwork::InputShapes{{inputname, {2, 1, 768}}}));
|
||||
@@ -143,7 +143,7 @@ TEST(SmartReshapeTests, SS_Squeeze_mask_use_negative) {
|
||||
<< network.getFunction()->get_results()[0]->get_output_partial_shape(0);
|
||||
ASSERT_TRUE(network.getFunction()->get_parameters()[0]->get_partial_shape().compatible({1, 3}));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_ANY_THROW(network.setBatchSize(2));
|
||||
check_unique_names(f, unh);
|
||||
@@ -174,7 +174,7 @@ TEST(SmartReshapeTests, SS_Squeeze_negative_stride_negative) {
|
||||
<< network.getFunction()->get_results()[0]->get_output_partial_shape(0);
|
||||
ASSERT_TRUE(network.getFunction()->get_parameters()[0]->get_partial_shape().compatible({1, 3}));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_ANY_THROW(network.setBatchSize(2));
|
||||
check_unique_names(f, unh);
|
||||
@@ -208,7 +208,7 @@ TEST(SmartReshapeTests, SS_SharedSqueezes) {
|
||||
<< network.getFunction()->get_results()[0]->get_output_partial_shape(0);
|
||||
ASSERT_TRUE(network.getFunction()->get_parameters()[0]->get_partial_shape().compatible({1, 3}));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.setBatchSize(2));
|
||||
check_unique_names(f, unh);
|
||||
@@ -243,7 +243,7 @@ TEST(SmartReshapeTests, SS_SqueezeNegativeAxes) {
|
||||
<< network.getFunction()->get_results()[0]->get_output_partial_shape(0);
|
||||
ASSERT_TRUE(network.getFunction()->get_parameters()[0]->get_partial_shape().compatible({1, 3, 1, 8, 1, 2}));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.setBatchSize(2));
|
||||
check_unique_names(f, unh);
|
||||
@@ -277,7 +277,7 @@ TEST(SmartReshapeTests, Squeeze_SSNegativeAxes) {
|
||||
<< network.getFunction()->get_results()[0]->get_output_partial_shape(0);
|
||||
ASSERT_TRUE(network.getFunction()->get_parameters()[0]->get_partial_shape().compatible({1, 3, 1, 8, 1, 2}));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.setBatchSize(2));
|
||||
check_unique_names(f, unh);
|
||||
|
||||
@@ -59,7 +59,7 @@ TEST(SmartReshapeTests, TensorIteratorStaticParameters) {
|
||||
ASSERT_TRUE(network.getFunction()->get_results()[2]->get_output_partial_shape(0).compatible({1, 1, 1}));
|
||||
ASSERT_TRUE(network.getFunction()->get_results()[3]->get_output_partial_shape(0).compatible({1, 1, 1}));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.reshape(
|
||||
InferenceEngine::ICNNNetwork::InputShapes{{f->get_parameters()[0]->get_friendly_name(), {32, 1, 10}},
|
||||
@@ -121,7 +121,7 @@ TEST(SmartReshapeTests, TensorIteratorDynamicParameters) {
|
||||
ASSERT_TRUE(network.getFunction()->get_results()[2]->get_output_partial_shape(0).compatible({1, 1, 1}));
|
||||
ASSERT_TRUE(network.getFunction()->get_results()[3]->get_output_partial_shape(0).compatible({1, 1, 1}));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.reshape(
|
||||
InferenceEngine::ICNNNetwork::InputShapes{{f->get_parameters()[0]->get_friendly_name(), {32, 1, 10}},
|
||||
@@ -191,7 +191,7 @@ TEST(SmartReshapeTests, LoopStaticParameters) {
|
||||
ASSERT_TRUE(
|
||||
network.getFunction()->get_results()[3]->get_output_partial_shape(0).compatible(PartialShape::dynamic()));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.reshape(
|
||||
InferenceEngine::ICNNNetwork::InputShapes{{f->get_parameters()[0]->get_friendly_name(), {32, 1, 10}},
|
||||
@@ -261,7 +261,7 @@ TEST(SmartReshapeTests, LoopDynamicParameters) {
|
||||
ASSERT_TRUE(
|
||||
network.getFunction()->get_results()[3]->get_output_partial_shape(0).compatible(PartialShape::dynamic()));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.reshape(
|
||||
InferenceEngine::ICNNNetwork::InputShapes{{f->get_parameters()[0]->get_friendly_name(), {32, 1, 10}},
|
||||
@@ -335,7 +335,7 @@ TEST(SmartReshapeTests, LoopParentParametersUsedInBody) {
|
||||
ASSERT_TRUE(
|
||||
network.getFunction()->get_results()[3]->get_output_partial_shape(0).compatible(PartialShape::dynamic()));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.reshape(
|
||||
InferenceEngine::ICNNNetwork::InputShapes{{f->get_parameters()[0]->get_friendly_name(), {4, 3, 2}},
|
||||
@@ -401,7 +401,7 @@ TEST(SmartReshapeTests, TensorIteratorParentParameterUsedInBody) {
|
||||
ASSERT_TRUE(network.getFunction()->get_results()[2]->get_output_partial_shape(0).compatible({1, 1, 1}));
|
||||
ASSERT_TRUE(network.getFunction()->get_results()[3]->get_output_partial_shape(0).compatible({1, 1, 1}));
|
||||
|
||||
auto unh = std::make_shared<ngraph::pass::UniqueNamesHolder>();
|
||||
auto unh = std::make_shared<ov::pass::UniqueNamesHolder>();
|
||||
init_unique_names(f, unh);
|
||||
ASSERT_NO_THROW(network.reshape(
|
||||
InferenceEngine::ICNNNetwork::InputShapes{{f->get_parameters()[0]->get_friendly_name(), {32, 1, 10}},
|
||||
|
||||
@@ -483,7 +483,7 @@ TEST(TransformationTests, ReorgYoloNegativeDifferentMax) {
|
||||
auto param = std::make_shared<Parameter>(ngraph::element::f32, ngraph::Shape{10, 10, 10, 10});
|
||||
auto reorg_yolo = std::make_shared<ReorgYolo>(param, stride);
|
||||
|
||||
return std::make_shared<ngraph::Function>(std::make_shared<ngraph::opset1::Result>(reorg_yolo),
|
||||
return std::make_shared<ngraph::Function>(std::make_shared<ov::op::v0::Result>(reorg_yolo),
|
||||
ngraph::ParameterVector{param});
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user