TransposeSinking Rafactoring part2: move the transformations to a separate folder, align namespaces

This commit is contained in:
Ivan 2023-03-14 21:59:28 +04:00
parent 7b91ac1e6b
commit e7759e1fa0
31 changed files with 149 additions and 165 deletions

View File

@ -4,7 +4,7 @@
#pragma once
#include <transformations/utils/utils.hpp>
#include "transformations/utils/utils.hpp"
#include <utility>
#include "openvino/op/util/op_types.hpp"

View File

@ -14,7 +14,6 @@
#include <vector>
#include "itt.hpp"
#include "transformations/common_optimizations/transpose_sinking_utils.hpp"
#include "transformations/utils/utils.hpp"
using namespace ov;
@ -318,8 +317,6 @@ ov::pass::TransposeFuse::TransposeFuse() {
new_transpose->set_friendly_name(m.get_match_root()->get_friendly_name());
ngraph::copy_runtime_info({transpose1, transpose2}, new_transpose);
ngraph::replace_node(m.get_match_root(), new_transpose);
transpose_sinking::UpdateForwardSinkingAbility(new_transpose);
}
return true;

View File

@ -2,20 +2,19 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/common_optimizations/transpose_sinking_binary.hpp"
#include <openvino/opsets/opset10.hpp>
#include <openvino/pass/pattern/op/or.hpp>
#include "transformations/transpose_sinking/transpose_sinking_binary.hpp"
#include "itt.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/op/util/op_types.hpp"
#include "openvino/pass/pattern/op/or.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
#include "transformations/common_optimizations/transpose_sinking_utils.hpp"
#include "transformations/rt_info/transpose_sinking_attr.hpp"
#include "transformations/transpose_sinking/transpose_sinking_utils.hpp"
using namespace ov::pass::pattern;
using namespace ov;
using namespace ov::opset10;
using namespace ov::pass::pattern;
using namespace transpose_sinking;
ov::pass::TransposeSinkingBinaryForward::TransposeSinkingBinaryForward() {

View File

@ -2,13 +2,13 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/common_optimizations/transpose_sinking_concat.hpp"
#include "transformations/transpose_sinking/transpose_sinking_concat.hpp"
#include "itt.hpp"
#include "openvino/op/util/op_types.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
#include "transformations/common_optimizations/transpose_sinking_utils.hpp"
#include "transformations/transpose_sinking/transpose_sinking_utils.hpp"
#include "transformations/rt_info/transpose_sinking_attr.hpp"
using namespace ov::pass::pattern;

View File

@ -2,16 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/common_optimizations/transpose_sinking_data_movement.hpp"
#include <openvino/pass/pattern/op/or.hpp>
#include "transformations/transpose_sinking/transpose_sinking_data_movement.hpp"
#include "itt.hpp"
#include "openvino/op/util/op_types.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
#include "openvino/util/common_util.hpp"
#include "transformations/common_optimizations/transpose_sinking_utils.hpp"
#include "transformations/transpose_sinking/transpose_sinking_utils.hpp"
#include "transformations/rt_info/transpose_sinking_attr.hpp"
using namespace ov;

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/common_optimizations/transpose_sinking_fuse.hpp"
#include "transformations/transpose_sinking/transpose_sinking_fuse.hpp"
#include <memory>
#include <vector>
@ -11,7 +11,7 @@
#include "openvino/core/validation_util.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
#include "transformations/common_optimizations/transpose_sinking_utils.hpp"
#include "transformations/transpose_sinking/transpose_sinking_utils.hpp"
#include "transformations/utils/utils.hpp"
using namespace ov;

View File

@ -2,22 +2,22 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/common_optimizations/transpose_sinking_general.hpp"
#include "transformations/transpose_sinking/transpose_sinking_general.hpp"
#include <openvino/pass/constant_folding.hpp>
#include <openvino/pass/graph_rewrite.hpp>
#include <openvino/pass/manager.hpp>
#include <openvino/pass/pattern/op/wrap_type.hpp>
#include "openvino/pass/constant_folding.hpp"
#include "openvino/pass/graph_rewrite.hpp"
#include "openvino/pass/manager.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
#include "itt.hpp"
#include "transformations/common_optimizations/transpose_sinking_binary.hpp"
#include "transformations/common_optimizations/transpose_sinking_concat.hpp"
#include "transformations/common_optimizations/transpose_sinking_data_movement.hpp"
#include "transformations/common_optimizations/transpose_sinking_fuse.hpp"
#include "transformations/common_optimizations/transpose_sinking_interpolate.hpp"
#include "transformations/common_optimizations/transpose_sinking_reduction.hpp"
#include "transformations/common_optimizations/transpose_sinking_split.hpp"
#include "transformations/common_optimizations/transpose_sinking_unary.hpp"
#include "transformations/transpose_sinking/transpose_sinking_binary.hpp"
#include "transformations/transpose_sinking/transpose_sinking_concat.hpp"
#include "transformations/transpose_sinking/transpose_sinking_data_movement.hpp"
#include "transformations/transpose_sinking/transpose_sinking_fuse.hpp"
#include "transformations/transpose_sinking/transpose_sinking_interpolate.hpp"
#include "transformations/transpose_sinking/transpose_sinking_reduction.hpp"
#include "transformations/transpose_sinking/transpose_sinking_split.hpp"
#include "transformations/transpose_sinking/transpose_sinking_unary.hpp"
#include "transformations/utils/utils.hpp"
ov::pass::TransposeSinkingGeneralForward::TransposeSinkingGeneralForward() {

View File

@ -2,16 +2,16 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/common_optimizations/transpose_sinking_interpolate.hpp"
#include "transformations/transpose_sinking/transpose_sinking_interpolate.hpp"
#include <openvino/pass/pattern/op/or.hpp>
#include "openvino/pass/pattern/op/or.hpp"
#include "itt.hpp"
#include "openvino/op/util/op_types.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
#include "openvino/util/common_util.hpp"
#include "transformations/common_optimizations/transpose_sinking_utils.hpp"
#include "transformations/transpose_sinking/transpose_sinking_utils.hpp"
#include "transformations/rt_info/transpose_sinking_attr.hpp"
using namespace ov;

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/common_optimizations/transpose_sinking_reduction.hpp"
#include "transformations/transpose_sinking/transpose_sinking_reduction.hpp"
#include <memory>
#include <vector>
@ -13,7 +13,7 @@
#include "openvino/op/util/logical_reduction_keep_dims.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
#include "transformations/common_optimizations/transpose_sinking_utils.hpp"
#include "transformations/transpose_sinking/transpose_sinking_utils.hpp"
#include "transformations/utils/utils.hpp"
using namespace ov;

View File

@ -2,19 +2,16 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/common_optimizations/transpose_sinking_split.hpp"
#include <openvino/pass/pattern/op/or.hpp>
#include <transformations/utils/utils.hpp>
#include <utility>
#include "transformations/transpose_sinking/transpose_sinking_split.hpp"
#include "itt.hpp"
#include "openvino/op/util/op_types.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/pattern/op/label.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
#include "transformations/common_optimizations/transpose_sinking_utils.hpp"
#include "transformations/transpose_sinking/transpose_sinking_utils.hpp"
#include "transformations/rt_info/transpose_sinking_attr.hpp"
#include "transformations/utils/utils.hpp"
using namespace ov::pass::pattern;
using namespace ov;

View File

@ -2,16 +2,16 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/common_optimizations/transpose_sinking_unary.hpp"
#include "transformations/transpose_sinking/transpose_sinking_unary.hpp"
#include <transformations/utils/utils.hpp>
#include <utility>
#include "itt.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
#include "transformations/common_optimizations/transpose_sinking_utils.hpp"
#include "transformations/transpose_sinking/transpose_sinking_utils.hpp"
#include "transformations/rt_info/transpose_sinking_attr.hpp"
#include "transformations/utils/utils.hpp"
using namespace ov;
using namespace ov::opset10;

View File

@ -2,15 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/common_optimizations/transpose_sinking_utils.hpp"
#include <transformations/utils/utils.hpp>
#include "transformations/transpose_sinking/transpose_sinking_utils.hpp"
#include "itt.hpp"
#include "openvino/op/util/op_types.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/util/common_util.hpp"
#include "transformations/rt_info/transpose_sinking_attr.hpp"
#include "transformations/utils/utils.hpp"
namespace transpose_sinking {

View File

@ -1,13 +1,12 @@
// Copyright (C) 2022 Intel Corporation
// Copyright (C) 2022-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <functional>
#include <openvino/frontend/manager.hpp>
#include <openvino/opsets/opset9.hpp>
#include <openvino/pass/manager.hpp>
#include <transformations/common_optimizations/transpose_sinking_binary.hpp>
#include <transformations/init_node_info.hpp>
#include "openvino/frontend/manager.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/manager.hpp"
#include "transformations/transpose_sinking/transpose_sinking_binary.hpp"
#include "common_test_utils/ngraph_test_utils.hpp"
#include "gtest/gtest.h"
@ -15,26 +14,9 @@
using namespace ov;
using namespace ov::opset10;
using namespace transpose_sinking::testing;
namespace transpose_sinking_binary_eltwise {
using namespace transpose_sinking::testing::utils;
namespace {
namespace {
std::string to_string(const Shape& shape) {
std::ostringstream result;
result << "{";
for (size_t idx = 0; idx < shape.size(); ++idx) {
if (idx)
result << ",";
result << shape[idx];
}
result << "}";
return result.str();
}
} // namespace
// ----------------------------------------------------------------------------
template <typename BinaryT>
class BinaryFactory : public IFactory {
@ -87,6 +69,10 @@ std::vector<size_t> binary_transpose_input_indexes = {0, 1};
} // namespace
namespace transpose_sinking {
namespace testing {
namespace binary {
namespace single_consumer {
namespace forward {
namespace one_input_transpose {
@ -207,7 +193,7 @@ class TransposeSinkingBinaryTwoTransposeInputsTestFixture
: public ::testing::WithParamInterface<TestBinaryTwoTransposeInputsParams>,
public TransformationTestsF {
public:
static std::string get_test_name(const testing::TestParamInfo<TestBinaryTwoTransposeInputsParams>& obj) {
static std::string get_test_name(const ::testing::TestParamInfo<TestBinaryTwoTransposeInputsParams>& obj) {
FactoryPtr binary_factory;
PassFactoryPtr pass_factory;
size_t num_binary_ops;
@ -327,7 +313,7 @@ using TestBinaryParams = std::tuple<FactoryPtr,
class TransposeSinkingBinaryTestFixture : public ::testing::WithParamInterface<TestBinaryParams>,
public TransformationTestsF {
public:
static std::string get_test_name(const testing::TestParamInfo<TestBinaryParams>& obj) {
static std::string get_test_name(const ::testing::TestParamInfo<TestBinaryParams>& obj) {
FactoryPtr binary_factory;
PassFactoryPtr pass_factory;
size_t num_binary_ops;
@ -421,7 +407,7 @@ class TransposeSinkingBinaryIncompatShapesTestFixture
: public ::testing::WithParamInterface<TestBinaryIncompatShapesParams>,
public TransformationTestsF {
public:
static std::string get_test_name(const testing::TestParamInfo<TestBinaryIncompatShapesParams>& obj) {
static std::string get_test_name(const ::testing::TestParamInfo<TestBinaryIncompatShapesParams>& obj) {
FactoryPtr binary_factory;
PassFactoryPtr pass_factory;
Shape input_shape;
@ -1090,7 +1076,7 @@ using TestBinaryParams = std::tuple<FactoryPtr,
class TransposeBinaryMultiSinkingFixture : public ::testing::WithParamInterface<TestBinaryParams>,
public TransformationTestsF {
public:
static std::string get_test_name(const testing::TestParamInfo<TestBinaryParams>& obj) {
static std::string get_test_name(const ::testing::TestParamInfo<TestBinaryParams>& obj) {
FactoryPtr binary_factory;
PassFactoryPtr pass_factory;
CreateGraphFunctionDesc function_desc;
@ -1177,7 +1163,7 @@ using TestBinaryParams = std::tuple<FactoryPtr,
class TransposeBinaryMultiSinkingBinaryMultiConsumersFixture : public ::testing::WithParamInterface<TestBinaryParams>,
public TransformationTestsF {
public:
static std::string get_test_name(const testing::TestParamInfo<TestBinaryParams>& obj) {
static std::string get_test_name(const ::testing::TestParamInfo<TestBinaryParams>& obj) {
FactoryPtr binary_factory;
PassFactoryPtr pass_factory;
CreateGraphFunctionDesc function_desc;
@ -1233,3 +1219,5 @@ INSTANTIATE_TEST_SUITE_P(TransposeSinkingBinaryBackwardBinaryMultiConsumersTestS
} // namespace mult_consumers
} // namespace transpose_sinking_binary_eltwise
}
}

View File

@ -2,26 +2,27 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <openvino/opsets/opset10.hpp>
#include <openvino/pass/manager.hpp>
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/manager.hpp"
#include "common_test_utils/ngraph_test_utils.hpp"
#include "gtest/gtest.h"
#include "transformations/common_optimizations/transpose_sinking_binary.hpp"
#include "transformations/common_optimizations/transpose_sinking_concat.hpp"
#include "transformations/common_optimizations/transpose_sinking_data_movement.hpp"
#include "transformations/common_optimizations/transpose_sinking_interpolate.hpp"
#include "transformations/common_optimizations/transpose_sinking_reduction.hpp"
#include "transformations/common_optimizations/transpose_sinking_split.hpp"
#include "transformations/common_optimizations/transpose_sinking_unary.hpp"
#include "transformations/transpose_sinking/transpose_sinking_binary.hpp"
#include "transformations/transpose_sinking/transpose_sinking_concat.hpp"
#include "transformations/transpose_sinking/transpose_sinking_data_movement.hpp"
#include "transformations/transpose_sinking/transpose_sinking_interpolate.hpp"
#include "transformations/transpose_sinking/transpose_sinking_reduction.hpp"
#include "transformations/transpose_sinking/transpose_sinking_split.hpp"
#include "transformations/transpose_sinking/transpose_sinking_unary.hpp"
#include "transpose_sinking_test_utils.hpp"
using namespace std;
using namespace ov;
using namespace ov::opset10;
using namespace transpose_sinking::testing;
using namespace transpose_sinking::testing::utils;
namespace transpose_sinking {
namespace testing {
namespace common {
template <typename UnaryT>
@ -371,12 +372,12 @@ auto test_forward_unary = [](const vector<FactoryPtr>& factories, const vector<s
// Test model description:
test_case.model.preprocess_inputs_to_main = {{set_transpose_for}, {{0}}};
test_case.model.main_op = factories;
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
test_case.model_ref.main_op = factories;
test_case.model_ref.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -402,13 +403,13 @@ auto test_forward_binary = []() {
// Test model description:
test_case.model.preprocess_inputs_to_main = {{set_transpose_for}, {{0}}};
test_case.model.main_op = binary_factories;
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
test_case.model_ref.preprocess_inputs_to_main = {{set_transpose_for}, {{1}}};
test_case.model_ref.main_op = binary_factories;
test_case.model_ref.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -430,13 +431,13 @@ auto test_forward_concat = []() {
// Test model description:
test_case.model.preprocess_inputs_to_main = {{set_transpose_for}, {{0}}};
test_case.model.main_op = {CREATE_CONCAT_FACTORY(Concat)};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
test_case.model_ref.preprocess_inputs_to_main = {{set_transpose_for}, {{1, 2}}};
test_case.model_ref.main_op = {CREATE_CONCAT_REF_FACTORY(Concat)};
test_case.model_ref.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -457,7 +458,7 @@ auto test_forward_split = []() {
// Test model description:
test_case.model.preprocess_inputs_to_main = {{set_transpose_for}, {{0}}};
test_case.model.main_op = {CREATE_SPLIT_FACTORY(Split)};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
auto new_constant = [](const vector<size_t>& idxs, const OutputVector& out_vec) -> OutputVector {
@ -470,7 +471,7 @@ auto test_forward_split = []() {
test_case.model_ref.preprocess_inputs_to_main = {{new_constant}, {{1}}};
test_case.model_ref.main_op = {CREATE_SPLIT_FACTORY(Split)};
test_case.model_ref.preprocess_outputs_of_main = {{set_transpose_for}, {{0, 1, 2}}};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -492,13 +493,13 @@ auto test_forward_pad = []() {
// Test model description:
test_case.model.preprocess_inputs_to_main = {{set_transpose_for}, {{0}}};
test_case.model.main_op = {CREATE_PAD_FACTORY(Pad)};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
test_case.model_ref.preprocess_inputs_to_main = {{set_gather_for}, {{1, 2}}};
test_case.model_ref.main_op = {CREATE_PAD_FACTORY(Pad)};
test_case.model_ref.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -521,13 +522,13 @@ auto test_forward_batch_to_space = []() {
// Test model description:
test_case.model.preprocess_inputs_to_main = {{set_transpose_for}, {{0}}};
test_case.model.main_op = {CREATE_BATCH_TO_SPACE_FACTORY(BatchToSpace)};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
test_case.model_ref.preprocess_inputs_to_main = {{set_gather_for}, {{1, 2, 3}}};
test_case.model_ref.main_op = {CREATE_BATCH_TO_SPACE_FACTORY(BatchToSpace)};
test_case.model_ref.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -552,13 +553,13 @@ auto test_forward_space_to_batch = []() {
// Test model description:
test_case.model.preprocess_inputs_to_main = {{set_transpose_for}, {{0}}};
test_case.model.main_op = {CREATE_SPACE_TO_BATCH_FACTORY(SpaceToBatch)};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
test_case.model_ref.preprocess_inputs_to_main = {{set_gather_for}, {{1, 2, 3}}};
test_case.model_ref.main_op = {CREATE_SPACE_TO_BATCH_FACTORY(SpaceToBatch)};
test_case.model_ref.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -581,7 +582,7 @@ auto test_forward_reduction = []() {
// Test model description:
test_case.model.preprocess_inputs_to_main = {{set_transpose_for}, {{0}}};
test_case.model.main_op = reduction_factories;
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
auto new_constant = [](const vector<size_t>& idxs, const OutputVector& out_vec) -> OutputVector {
@ -594,7 +595,7 @@ auto test_forward_reduction = []() {
test_case.model_ref.preprocess_inputs_to_main = {{new_constant}, {{1}}};
test_case.model_ref.main_op = reduction_factories;
test_case.model_ref.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -617,7 +618,7 @@ auto test_forward_interpolate = []() {
// Test model description:
test_case.model.preprocess_inputs_to_main = {{set_transpose_for}, {{0}}};
test_case.model.main_op = {CREATE_INTERPOLATE_FACTORY(Interpolate, false)};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
auto set_specific_gather_for = [](const vector<size_t>& idxs, const OutputVector& out_vec) -> OutputVector {
@ -637,7 +638,7 @@ auto test_forward_interpolate = []() {
test_case.model_ref.preprocess_inputs_to_main = {{set_specific_gather_for}, {{3}}};
test_case.model_ref.main_op = {CREATE_INTERPOLATE_FACTORY(Interpolate, true)};
test_case.model_ref.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -660,7 +661,7 @@ auto test_forward_squeeze = []() {
// Test model description:
test_case.model.preprocess_inputs_to_main = {{set_transpose_for}, {{0}}};
test_case.model.main_op = {CREATE_BINARY_FACTORY(Squeeze)};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
auto new_constant = [](const vector<size_t>& idxs, const OutputVector& out_vec) -> OutputVector {
@ -673,7 +674,7 @@ auto test_forward_squeeze = []() {
test_case.model_ref.preprocess_inputs_to_main = {{new_constant}, {{1}}};
test_case.model_ref.main_op = {CREATE_BINARY_FACTORY(Squeeze)};
test_case.model_ref.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -694,7 +695,7 @@ auto test_forward_unsqueeze = []() {
// Test model description:
test_case.model.preprocess_inputs_to_main = {{set_transpose_for}, {{0}}};
test_case.model.main_op = {CREATE_BINARY_FACTORY(Unsqueeze)};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
auto new_constant = [](const vector<size_t>& idxs, const OutputVector& out_vec) -> OutputVector {
@ -714,7 +715,7 @@ auto test_forward_unsqueeze = []() {
return new_out_vec;
};
test_case.model_ref.preprocess_outputs_of_main = {{new_transpose}, {{0}}};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -736,12 +737,12 @@ auto test_backward_unary = []() {
// Test model description:
test_case.model.main_op = unary_factories;
test_case.model.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
test_case.model_ref.preprocess_inputs_to_main = {{set_transpose_for}, {{0}}};
test_case.model_ref.main_op = unary_factories;
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -762,12 +763,12 @@ auto test_backward_binary = []() {
// Test model description:
test_case.model.main_op = binary_factories;
test_case.model.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
test_case.model_ref.preprocess_inputs_to_main = {{set_transpose_for}, {{0, 1}}};
test_case.model_ref.main_op = binary_factories;
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -789,12 +790,12 @@ auto test_backward_concat = []() {
// Test model description:
test_case.model.main_op = {CREATE_CONCAT_FACTORY(Concat)};
test_case.model.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
test_case.model_ref.preprocess_inputs_to_main = {{set_transpose_for}, {{0, 1, 2}}};
test_case.model_ref.main_op = {CREATE_CONCAT_REF_FACTORY(Concat)};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -815,7 +816,7 @@ auto test_backward_split = []() {
// Test model description:
test_case.model.main_op = {CREATE_SPLIT_FACTORY(Split)};
test_case.model.preprocess_outputs_of_main = {{set_transpose_for}, {{0, 1, 2}}};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
auto new_constant = [](const vector<size_t>& idxs, const OutputVector& out_vec) -> OutputVector {
@ -827,7 +828,7 @@ auto test_backward_split = []() {
};
test_case.model_ref.preprocess_inputs_to_main = {{set_transpose_for, new_constant}, {{0}, {1}}};
test_case.model_ref.main_op = {CREATE_SPLIT_FACTORY(Split)};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -848,12 +849,12 @@ auto test_backward_pad = []() {
// Test model description:
test_case.model.main_op = {CREATE_PAD_FACTORY(Pad)};
test_case.model.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
test_case.model_ref.preprocess_inputs_to_main = {{set_transpose_for, set_gather_for}, {{0}, {1, 2}}};
test_case.model_ref.main_op = {CREATE_PAD_FACTORY(Pad)};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -876,12 +877,12 @@ auto test_backward_batch_to_space = []() {
// Reference model description:
test_case.model.main_op = {CREATE_BATCH_TO_SPACE_FACTORY(BatchToSpace)};
test_case.model.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Test model description:
test_case.model_ref.preprocess_inputs_to_main = {{set_transpose_for, set_gather_for}, {{0}, {1, 2, 3}}};
test_case.model_ref.main_op = {CREATE_BATCH_TO_SPACE_FACTORY(BatchToSpace)};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -906,12 +907,12 @@ auto test_backward_space_to_batch = []() {
// Test model description:
test_case.model.main_op = {CREATE_SPACE_TO_BATCH_FACTORY(SpaceToBatch)};
test_case.model.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
test_case.model_ref.preprocess_inputs_to_main = {{set_transpose_for, set_gather_for}, {{0}, {1, 2, 3}}};
test_case.model_ref.main_op = {CREATE_SPACE_TO_BATCH_FACTORY(SpaceToBatch)};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -933,7 +934,7 @@ auto test_backward_reduction = []() {
// Test model description:
test_case.model.main_op = reduction_factories;
test_case.model.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
auto new_constant = [](const vector<size_t>& idxs, const OutputVector& out_vec) -> OutputVector {
@ -945,7 +946,7 @@ auto test_backward_reduction = []() {
};
test_case.model_ref.preprocess_inputs_to_main = {{set_transpose_for, new_constant}, {{0}, {1}}};
test_case.model_ref.main_op = reduction_factories;
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -970,7 +971,7 @@ auto test_backward_interpolate = []() {
// Test model description:
test_case.model.main_op = {CREATE_INTERPOLATE_FACTORY(Interpolate, true)};
test_case.model.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
auto set_specific_gather_for = [](const vector<size_t>& idxs, const OutputVector& out_vec) -> OutputVector {
@ -989,7 +990,7 @@ auto test_backward_interpolate = []() {
};
test_case.model_ref.preprocess_inputs_to_main = {{set_transpose_for, set_specific_gather_for}, {{0}, {3}}};
test_case.model_ref.main_op = {CREATE_INTERPOLATE_FACTORY(Interpolate, false)};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -1012,7 +1013,7 @@ auto test_backward_squeeze = []() {
// Test model description:
test_case.model.main_op = {CREATE_BINARY_FACTORY(Squeeze)};
test_case.model.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
auto new_transpose = [](const vector<size_t>& idxs, const OutputVector& out_vec) -> OutputVector {
@ -1024,7 +1025,7 @@ auto test_backward_squeeze = []() {
};
test_case.model_ref.preprocess_inputs_to_main = {{new_transpose}, {{0}}};
test_case.model_ref.main_op = {CREATE_BINARY_FACTORY(Squeeze)};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -1045,7 +1046,7 @@ auto test_backward_unsqueeze = []() {
// Test model description:
test_case.model.main_op = {CREATE_BINARY_FACTORY(Unsqueeze)};
test_case.model.preprocess_outputs_of_main = {{set_transpose_for}, {{0}}};
test_case.model.model_template = transpose_sinking::common::create_model;
test_case.model.model_template = create_model;
// Reference model description:
auto new_constant = [](const vector<size_t>& idxs, const OutputVector& out_vec) -> OutputVector {
@ -1057,7 +1058,7 @@ auto test_backward_unsqueeze = []() {
};
test_case.model_ref.preprocess_inputs_to_main = {{set_transpose_for, new_constant}, {{0}, {1}}};
test_case.model_ref.main_op = {CREATE_BINARY_FACTORY(Unsqueeze)};
test_case.model_ref.model_template = transpose_sinking::common::create_model;
test_case.model_ref.model_template = create_model;
return wrapper(test_case);
};
@ -1066,4 +1067,5 @@ INSTANTIATE_TEST_SUITE_P(TransposeSinkingCommonUnsqueezeBackward,
TransposeSinkingTestFixture,
test_backward_unsqueeze());
} // namespace common
} // namespace testing
} // namespace transpose_sinking

View File

@ -1,14 +1,14 @@
// Copyright (C) 2022 Intel Corporation
// Copyright (C) 2022-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <functional>
#include <openvino/frontend/manager.hpp>
#include <openvino/opsets/opset10.hpp>
#include <openvino/pass/manager.hpp>
#include <transformations/common_optimizations/transpose_sinking_concat.hpp>
#include <transformations/common_optimizations/transpose_sinking_utils.hpp>
#include <transformations/init_node_info.hpp>
#include "openvino/frontend/manager.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/manager.hpp"
#include "transformations/transpose_sinking/transpose_sinking_concat.hpp"
#include "transformations/transpose_sinking/transpose_sinking_utils.hpp"
#include "transformations/init_node_info.hpp"
#include "common_test_utils/ngraph_test_utils.hpp"
#include "gtest/gtest.h"
@ -16,12 +16,11 @@
using namespace ov;
using namespace ov::opset10;
using namespace transpose_sinking::testing;
using namespace transpose_sinking::testing::utils;
namespace {
std::vector<size_t> concat_operations_numbers = {1, 10};
std::vector<size_t> concat_transpose_input_indexes = {0, 2};
NodePtr CreateConcatChain(NodePtr input_node,

View File

@ -1,13 +1,13 @@
// Copyright (C) 2022 Intel Corporation
// Copyright (C) 2022-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <functional>
#include <openvino/frontend/manager.hpp>
#include <openvino/opsets/opset10.hpp>
#include <openvino/pass/manager.hpp>
#include <transformations/common_optimizations/transpose_sinking_general.hpp>
#include <transformations/init_node_info.hpp>
#include "openvino/frontend/manager.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/manager.hpp"
#include "transformations/transpose_sinking/transpose_sinking_general.hpp"
#include "transformations/init_node_info.hpp"
#include "common_test_utils/ngraph_test_utils.hpp"
#include "gtest/gtest.h"

View File

@ -1,13 +1,13 @@
// Copyright (C) 2022 Intel Corporation
// Copyright (C) 2022-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <functional>
#include <openvino/frontend/manager.hpp>
#include <openvino/opsets/opset10.hpp>
#include <openvino/pass/manager.hpp>
#include <transformations/common_optimizations/transpose_sinking_split.hpp>
#include <transformations/init_node_info.hpp>
#include "openvino/frontend/manager.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/manager.hpp"
#include "transformations/transpose_sinking/transpose_sinking_split.hpp"
#include "transformations/init_node_info.hpp"
#include "common_test_utils/ngraph_test_utils.hpp"
#include "gtest/gtest.h"
@ -15,6 +15,7 @@
using namespace ov;
using namespace ov::opset10;
using namespace transpose_sinking::testing::utils;
namespace transpose_sinking {
namespace testing {

View File

@ -4,9 +4,9 @@
#include "transpose_sinking_test_utils.hpp"
#include <openvino/frontend/manager.hpp>
#include <openvino/opsets/opset10.hpp>
#include <openvino/pass/manager.hpp>
#include "openvino/frontend/manager.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/manager.hpp"
#include "gtest/gtest.h"
@ -16,6 +16,7 @@ using namespace ov::opset10;
namespace transpose_sinking {
namespace testing {
namespace utils {
shared_ptr<Node> create_main_node(const OutputVector& inputs, size_t num_ops, const FactoryPtr& creator) {
OutputVector current_inputs = inputs;
@ -83,5 +84,6 @@ std::shared_ptr<ov::Node> parameter(ov::element::Type el_type, const PartialShap
return std::make_shared<Parameter>(el_type, ps);
}
} // utils
} // namespace testing
} // namespace transpose_sinking

View File

@ -4,15 +4,16 @@
#pragma once
#include <openvino/frontend/manager.hpp>
#include <openvino/opsets/opset10.hpp>
#include <openvino/pass/manager.hpp>
#include "openvino/frontend/manager.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/manager.hpp"
#include "common_test_utils/ngraph_test_utils.hpp"
#include "gtest/gtest.h"
namespace transpose_sinking {
namespace testing {
namespace utils {
using NodePtr = std::shared_ptr<ov::Node>;
@ -67,5 +68,6 @@ std::shared_ptr<ov::Node> constant(ov::element::Type el_type, const ov::Shape& s
return ov::opset10::Constant::create<T>(el_type, shape, value);
}
} // utils
} // namespace testing
} // namespace transpose_sinking

View File

@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/common_optimizations/transpose_sinking_unary.hpp"
#include "transformations/transpose_sinking/transpose_sinking_unary.hpp"
#include <openvino/frontend/manager.hpp>
#include <openvino/opsets/opset10.hpp>
#include <openvino/pass/manager.hpp>
#include "openvino/frontend/manager.hpp"
#include "openvino/opsets/opset10.hpp"
#include "openvino/pass/manager.hpp"
#include "common_test_utils/ngraph_test_utils.hpp"
#include "gtest/gtest.h"
@ -14,7 +14,7 @@
using namespace ov;
using namespace ov::opset10;
using namespace transpose_sinking::testing;
using namespace transpose_sinking::testing::utils;
namespace transpose_sinking {
namespace testing {

View File

@ -21,7 +21,7 @@
#include "so_extension.hpp"
#include "tf_framework_node.hpp"
#include "transformations/common_optimizations/reverse_shape_and_type_infer.hpp"
#include "transformations/common_optimizations/transpose_sinking_general.hpp"
#include "transformations/transpose_sinking/transpose_sinking_general.hpp"
#include "translate_session.hpp"
#include "utils.hpp"

View File

@ -17,7 +17,7 @@
#include "tflite_transformations/rfft2d_complex_abs.h"
#include "tflite_transformations/tflite_quantize_resolver.hpp"
#include "transformations/common_optimizations/transpose_sinking.hpp"
#include "transformations/common_optimizations/transpose_sinking_general.hpp"
#include "transformations/transpose_sinking/transpose_sinking_general.hpp"
using namespace ov;
using namespace ov::frontend::tensorflow_lite;