Move ConvEltwiseFuse to new API (#20331)

This commit is contained in:
Ilya Churaev
2023-10-10 09:32:18 +04:00
committed by GitHub
parent e30f75bb4d
commit cf83750867
5 changed files with 28 additions and 11 deletions
@@ -8,7 +8,7 @@
#include "common_test_utils/test_constants.hpp"
using namespace SubgraphTestsDefinitions;
using namespace ov::test;
namespace {
const std::vector<ov::element::Type> types{ov::element::f32, ov::element::f16};
@@ -6,10 +6,12 @@
#include "shared_test_classes/subgraph/conv_eltwise_fusion.hpp"
namespace SubgraphTestsDefinitions {
namespace ov {
namespace test {
TEST_P(ConvEltwiseFusion, CompareWithRefs) {
Run();
run();
}
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov
@@ -106,5 +106,16 @@ inline std::vector<InputShape> static_shapes_to_test_representation(const std::v
}
return result;
}
class SubgraphBaseStaticTest : public ov::test::SubgraphBaseTest {
public:
void run() override {
std::vector<ov::Shape> input_shapes;
for (const auto& param : function->get_parameters())
input_shapes.emplace_back(param->get_shape());
init_input_shapes(ov::test::static_shapes_to_test_representation(input_shapes));
ov::test::SubgraphBaseTest::run();
}
};
} // namespace test
} // namespace ov
@@ -10,8 +10,10 @@
#include "ov_models/builders.hpp"
#include "shared_test_classes/base/layer_test_utils.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp"
namespace SubgraphTestsDefinitions {
namespace ov {
namespace test {
typedef std::tuple<std::tuple<ov::NodeTypeInfo, // Convolution type
size_t // Number of inputs
@@ -27,7 +29,7 @@ typedef std::tuple<std::tuple<ov::NodeTypeInfo, // Convolution type
ConvEltwiseFusionParams;
class ConvEltwiseFusion : public testing::WithParamInterface<ConvEltwiseFusionParams>,
virtual public LayerTestsUtils::LayerTestsCommon {
virtual public ov::test::SubgraphBaseStaticTest {
public:
static std::string getTestCaseName(const testing::TestParamInfo<ConvEltwiseFusionParams>& obj);
@@ -35,4 +37,5 @@ protected:
void SetUp() override;
};
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov
@@ -8,11 +8,11 @@
#include "openvino/opsets/opset11.hpp"
#include "openvino/pass/constant_folding.hpp"
#include "ov_models/builders.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp"
#include "transformations/common_optimizations/conv_mul_fusion.hpp"
using namespace ov;
namespace SubgraphTestsDefinitions {
namespace ov {
namespace test {
std::string ConvEltwiseFusion::getTestCaseName(const testing::TestParamInfo<ConvEltwiseFusionParams>& obj) {
std::tuple<NodeTypeInfo, size_t> conv_params;
@@ -205,4 +205,5 @@ void ConvEltwiseFusion::SetUp() {
auto res = compare_functions(cloned_function, function_ref);
ASSERT_TRUE(res.first) << res.second;
}
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov