Migrate subgraph tests till quantized subgraph (#20351)

* Migrate subgraph tests till quatized subgraph

* Fixed code style

* Fixed code style

* Try to fix build

* Remove run method

* Remove GNA test
This commit is contained in:
Ilya Churaev 2023-10-13 13:35:13 +04:00 committed by GitHub
parent e289e8282d
commit e866bfef42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 654 additions and 682 deletions

View File

@ -2,263 +2,268 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "subgraph_tests/mul_conv_fusion.hpp"
#include <vector>
#include "subgraph_tests/mul_conv_fusion.hpp"
#include "common_test_utils/test_constants.hpp"
#include <ngraph/opsets/opset8.hpp>
using namespace SubgraphTestsDefinitions;
using namespace ov::test;
namespace {
const std::vector<ngraph::element::Type> types{ngraph::element::f32};
const std::vector<ov::element::Type> types{ov::element::f32};
const std::vector<ngraph::Shape> const_shapes_fprop_1d{
{},
{1},
{1, 1},
{8, 1},
{1, 1, 1},
{1, 8, 1},
};
const std::vector<ov::Shape> const_shapes_fprop_1d{
{},
{1},
{1, 1},
{8, 1},
{1, 1, 1},
{1, 8, 1},
};
INSTANTIATE_TEST_SUITE_P(smoke_Convolution_1D, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::Convolution::get_type_info_static()),
::testing::Values(ngraph::Shape{1, 8, 64}),
::testing::Values(ngraph::Shape{64, 8, 1}),
::testing::ValuesIn(const_shapes_fprop_1d),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Convolution_1D,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::Convolution::get_type_info_static()),
::testing::Values(ov::Shape{1, 8, 64}),
::testing::Values(ov::Shape{64, 8, 1}),
::testing::ValuesIn(const_shapes_fprop_1d),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
const std::vector<ngraph::Shape> const_shapes_fprop_2d{
{},
{1},
{1, 1},
{1, 1, 1},
{8, 1, 1},
{1, 1, 1, 1},
{1, 8, 1, 1},
};
const std::vector<ov::Shape> const_shapes_fprop_2d{
{},
{1},
{1, 1},
{1, 1, 1},
{8, 1, 1},
{1, 1, 1, 1},
{1, 8, 1, 1},
};
INSTANTIATE_TEST_SUITE_P(smoke_Convolution_2D, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::Convolution::get_type_info_static()),
::testing::Values(ngraph::Shape{2, 8, 14, 14}),
::testing::Values(ngraph::Shape{2, 8, 7, 7}),
::testing::ValuesIn(const_shapes_fprop_2d),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Convolution_2D,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::Convolution::get_type_info_static()),
::testing::Values(ov::Shape{2, 8, 14, 14}),
::testing::Values(ov::Shape{2, 8, 7, 7}),
::testing::ValuesIn(const_shapes_fprop_2d),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
const std::vector<ngraph::Shape> const_shapes_fprop_2d_kernel_same_as_input{
{7},
{1, 7},
{1, 1, 7},
{8, 1, 7},
{1, 1, 1, 7},
{1, 8, 1, 7},
{7, 1},
{1, 7, 1},
{8, 7, 1},
{1, 1, 7, 1},
{1, 8, 7, 1},
{1, 1, 7, 7},
{1, 8, 7, 7},
};
const std::vector<ov::Shape> const_shapes_fprop_2d_kernel_same_as_input{
{7},
{1, 7},
{1, 1, 7},
{8, 1, 7},
{1, 1, 1, 7},
{1, 8, 1, 7},
{7, 1},
{1, 7, 1},
{8, 7, 1},
{1, 1, 7, 1},
{1, 8, 7, 1},
{1, 1, 7, 7},
{1, 8, 7, 7},
};
INSTANTIATE_TEST_SUITE_P(smoke_Convolution_2D_kernel_same_as_input, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::Convolution::get_type_info_static()),
::testing::Values(ngraph::Shape{2, 8, 7, 7}),
::testing::Values(ngraph::Shape{3, 8, 7, 7}),
::testing::ValuesIn(const_shapes_fprop_2d_kernel_same_as_input),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Convolution_2D_kernel_same_as_input,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::Convolution::get_type_info_static()),
::testing::Values(ov::Shape{2, 8, 7, 7}),
::testing::Values(ov::Shape{3, 8, 7, 7}),
::testing::ValuesIn(const_shapes_fprop_2d_kernel_same_as_input),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
const std::vector<ngraph::Shape> const_shapes_conv_bprop{
{},
{1},
{1, 1},
{1, 1, 1},
{1, 1, 1, 1},
{3, 1, 1},
{1, 3, 1, 1},
};
INSTANTIATE_TEST_SUITE_P(smoke_ConvolutionBackpropData_2D, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::ConvolutionBackpropData::get_type_info_static()),
::testing::Values(ngraph::Shape{4, 3, 64, 64}),
::testing::Values(ngraph::Shape{3, 20, 3, 3}),
::testing::ValuesIn(const_shapes_conv_bprop),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
const std::vector<ov::Shape> const_shapes_conv_bprop{
{},
{1},
{1, 1},
{1, 1, 1},
{1, 1, 1, 1},
{3, 1, 1},
{1, 3, 1, 1},
};
INSTANTIATE_TEST_SUITE_P(
smoke_ConvolutionBackpropData_2D,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::ConvolutionBackpropData::get_type_info_static()),
::testing::Values(ov::Shape{4, 3, 64, 64}),
::testing::Values(ov::Shape{3, 20, 3, 3}),
::testing::ValuesIn(const_shapes_conv_bprop),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
const std::vector<ngraph::Shape> const_shapes_group_conv{
{},
{1},
{1, 1},
{1, 1, 1},
{12, 1, 1},
{1, 1, 1, 1},
{1, 12, 1, 1},
};
const std::vector<ov::Shape> const_shapes_group_conv{
{},
{1},
{1, 1},
{1, 1, 1},
{12, 1, 1},
{1, 1, 1, 1},
{1, 12, 1, 1},
};
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolution_2D, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::GroupConvolution::get_type_info_static()),
::testing::Values(ngraph::Shape{2, 12, 14, 14}),
::testing::Values(ngraph::Shape{4, 5, 3, 7, 7}),
::testing::ValuesIn(const_shapes_group_conv),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolution_2D,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::GroupConvolution::get_type_info_static()),
::testing::Values(ov::Shape{2, 12, 14, 14}),
::testing::Values(ov::Shape{4, 5, 3, 7, 7}),
::testing::ValuesIn(const_shapes_group_conv),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
const std::vector<ngraph::Shape> const_shapes_group_conv_kernel_same_as_input{
{14},
{1, 14},
{1, 1, 14},
{12, 1, 14},
{1, 1, 1, 14},
{1, 12, 1, 14},
{14, 1},
{1, 14, 1},
{12, 14, 1},
{1, 1, 14, 1},
{1, 12, 14, 1},
{1, 1, 14, 14},
{1, 12, 14, 14},
};
const std::vector<ov::Shape> const_shapes_group_conv_kernel_same_as_input{
{14},
{1, 14},
{1, 1, 14},
{12, 1, 14},
{1, 1, 1, 14},
{1, 12, 1, 14},
{14, 1},
{1, 14, 1},
{12, 14, 1},
{1, 1, 14, 1},
{1, 12, 14, 1},
{1, 1, 14, 14},
{1, 12, 14, 14},
};
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolution_2D_kernel_same_as_input, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::GroupConvolution::get_type_info_static()),
::testing::Values(ngraph::Shape{2, 12, 14, 14}),
::testing::Values(ngraph::Shape{4, 5, 3, 14, 14}),
::testing::ValuesIn(const_shapes_group_conv_kernel_same_as_input),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolution_2D_kernel_same_as_input,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::GroupConvolution::get_type_info_static()),
::testing::Values(ov::Shape{2, 12, 14, 14}),
::testing::Values(ov::Shape{4, 5, 3, 14, 14}),
::testing::ValuesIn(const_shapes_group_conv_kernel_same_as_input),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
const std::vector<ngraph::Shape> const_shapes_group_conv_bprop{
{},
{1},
{1, 1},
{1, 1, 1},
{12, 1, 1},
{1, 1, 1, 1},
{1, 12, 1, 1},
};
const std::vector<ov::Shape> const_shapes_group_conv_bprop{
{},
{1},
{1, 1},
{1, 1, 1},
{12, 1, 1},
{1, 1, 1, 1},
{1, 12, 1, 1},
};
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolutionBackpropData_2D, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::GroupConvolutionBackpropData::get_type_info_static()),
::testing::Values(ngraph::Shape{2, 12, 10, 10}),
::testing::Values(ngraph::Shape{4, 3, 5, 2, 2}),
::testing::ValuesIn(const_shapes_group_conv_bprop),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(
smoke_GroupConvolutionBackpropData_2D,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::GroupConvolutionBackpropData::get_type_info_static()),
::testing::Values(ov::Shape{2, 12, 10, 10}),
::testing::Values(ov::Shape{4, 3, 5, 2, 2}),
::testing::ValuesIn(const_shapes_group_conv_bprop),
::testing::ValuesIn(types),
::testing::Values(false), // Positive test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
const std::vector<ngraph::Shape> negative_const_shapes{
{12, 64, 64},
{2, 1, 1, 1},
{1, 1, 64, 64},
{1, 12, 64, 64},
{2, 12, 64, 64},
};
const std::vector<ov::Shape> negative_const_shapes{
{12, 64, 64},
{2, 1, 1, 1},
{1, 1, 64, 64},
{1, 12, 64, 64},
{2, 12, 64, 64},
};
INSTANTIATE_TEST_SUITE_P(smoke_NegativeConvolution_2D, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::Convolution::get_type_info_static()),
::testing::Values(ngraph::Shape{2, 12, 64, 64}),
::testing::Values(ngraph::Shape{20, 12, 1, 1}),
::testing::ValuesIn(negative_const_shapes),
::testing::ValuesIn(types),
::testing::Values(true), // Negative test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_NegativeConvolution_2D,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::Convolution::get_type_info_static()),
::testing::Values(ov::Shape{2, 12, 64, 64}),
::testing::Values(ov::Shape{20, 12, 1, 1}),
::testing::ValuesIn(negative_const_shapes),
::testing::ValuesIn(types),
::testing::Values(true), // Negative test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_NegativeConvolutionBackpropData_2D, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::ConvolutionBackpropData::get_type_info_static()),
::testing::Values(ngraph::Shape{2, 12, 64, 64}),
::testing::Values(ngraph::Shape{12, 20, 3, 3}),
::testing::ValuesIn(negative_const_shapes),
::testing::ValuesIn(types),
::testing::Values(true), // Negative test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(
smoke_NegativeConvolutionBackpropData_2D,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::ConvolutionBackpropData::get_type_info_static()),
::testing::Values(ov::Shape{2, 12, 64, 64}),
::testing::Values(ov::Shape{12, 20, 3, 3}),
::testing::ValuesIn(negative_const_shapes),
::testing::ValuesIn(types),
::testing::Values(true), // Negative test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_NegativeGroupConvolution_2D, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::GroupConvolution::get_type_info_static()),
::testing::Values(ngraph::Shape{2, 12, 64, 64}),
::testing::Values(ngraph::Shape{4, 5, 3, 1, 2}),
::testing::ValuesIn(negative_const_shapes),
::testing::ValuesIn(types),
::testing::Values(true), // Negative test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_NegativeGroupConvolution_2D,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::GroupConvolution::get_type_info_static()),
::testing::Values(ov::Shape{2, 12, 64, 64}),
::testing::Values(ov::Shape{4, 5, 3, 1, 2}),
::testing::ValuesIn(negative_const_shapes),
::testing::ValuesIn(types),
::testing::Values(true), // Negative test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_NegativeGroupConvolutionBackpropData_2D, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::GroupConvolutionBackpropData::get_type_info_static()),
::testing::Values(ngraph::Shape{2, 12, 64, 64}),
::testing::Values(ngraph::Shape{4, 3, 5, 1, 1}),
::testing::ValuesIn(negative_const_shapes),
::testing::ValuesIn(types),
::testing::Values(true), // Negative test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(
smoke_NegativeGroupConvolutionBackpropData_2D,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::GroupConvolutionBackpropData::get_type_info_static()),
::testing::Values(ov::Shape{2, 12, 64, 64}),
::testing::Values(ov::Shape{4, 3, 5, 1, 1}),
::testing::ValuesIn(negative_const_shapes),
::testing::ValuesIn(types),
::testing::Values(true), // Negative test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
const std::vector<ngraph::Shape> negative_const_shapes_kernel_same_as_input{
{7},
{1, 7},
{1, 1, 7},
{12, 1, 7},
{1, 1, 1, 7},
{1, 12, 1, 7},
{7, 1},
{1, 7, 1},
{12, 7, 1},
{1, 1, 7, 1},
{1, 12, 7, 1},
{1, 1, 7, 7},
{1, 12, 7, 7},
};
const std::vector<ov::Shape> negative_const_shapes_kernel_same_as_input{
{7},
{1, 7},
{1, 1, 7},
{12, 1, 7},
{1, 1, 1, 7},
{1, 12, 1, 7},
{7, 1},
{1, 7, 1},
{12, 7, 1},
{1, 1, 7, 1},
{1, 12, 7, 1},
{1, 1, 7, 7},
{1, 12, 7, 7},
};
INSTANTIATE_TEST_SUITE_P(smoke_NegativeConvolutionBackpropData_2D_kernel_same_as_input, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::ConvolutionBackpropData::get_type_info_static()),
::testing::Values(ngraph::Shape{2, 12, 7, 7}),
::testing::Values(ngraph::Shape{12, 20, 7, 7}),
::testing::ValuesIn(negative_const_shapes_kernel_same_as_input),
::testing::ValuesIn(types),
::testing::Values(true), // Negative test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(
smoke_NegativeConvolutionBackpropData_2D_kernel_same_as_input,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::ConvolutionBackpropData::get_type_info_static()),
::testing::Values(ov::Shape{2, 12, 7, 7}),
::testing::Values(ov::Shape{12, 20, 7, 7}),
::testing::ValuesIn(negative_const_shapes_kernel_same_as_input),
::testing::ValuesIn(types),
::testing::Values(true), // Negative test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_NegativeGroupConvolutionBackpropData_2D_kernel_same_as_input, MulConvFusion,
::testing::Combine(
::testing::Values(ngraph::opset8::GroupConvolutionBackpropData::get_type_info_static()),
::testing::Values(ngraph::Shape{2, 12, 7, 7}),
::testing::Values(ngraph::Shape{4, 3, 5, 7, 7}),
::testing::ValuesIn(negative_const_shapes_kernel_same_as_input),
::testing::ValuesIn(types),
::testing::Values(true), // Negative test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(
smoke_NegativeGroupConvolutionBackpropData_2D_kernel_same_as_input,
MulConvFusion,
::testing::Combine(::testing::Values(ov::op::v1::GroupConvolutionBackpropData::get_type_info_static()),
::testing::Values(ov::Shape{2, 12, 7, 7}),
::testing::Values(ov::Shape{4, 3, 5, 7, 7}),
::testing::ValuesIn(negative_const_shapes_kernel_same_as_input),
::testing::ValuesIn(types),
::testing::Values(true), // Negative test
::testing::Values(ov::test::utils::DEVICE_CPU)),
MulConvFusion::getTestCaseName);
} // namespace

View File

@ -2,31 +2,29 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "subgraph_tests/multiply_add.hpp"
using namespace SubgraphTestsDefinitions;
#include <vector>
using namespace ov::test;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32
const std::vector<ov::element::Type> input_type = {ov::element::f32};
const std::vector<ov::Shape> inputShapes = {
{1, 3, 2, 2, 4, 5},
{1, 3, 2, 2, 2, 4, 5},
{1, 3, 2, 2, 2, 2, 4, 5},
{1, 3, 2, 2, 2, 2, 2, 4, 5},
{1, 3, 2, 2, 2, 2, 2, 2, 4, 5},
};
const std::vector<std::vector<size_t>> inputShapes = {
{1, 3, 2, 2, 4, 5},
{1, 3, 2, 2, 2, 4, 5},
{1, 3, 2, 2, 2, 2, 4, 5},
{1, 3, 2, 2, 2, 2, 2, 4, 5},
{1, 3, 2, 2, 2, 2, 2, 2, 4, 5},
};
INSTANTIATE_TEST_SUITE_P(smoke_MultipleAdd_Nd, MultiplyAddLayerTest,
::testing::Combine(
::testing::ValuesIn(inputShapes),
::testing::ValuesIn(netPrecisions),
::testing::Values(ov::test::utils::DEVICE_CPU)),
MultiplyAddLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_MultipleAdd_Nd,
MultiplyAddLayerTest,
::testing::Combine(::testing::ValuesIn(inputShapes),
::testing::ValuesIn(input_type),
::testing::Values(ov::test::utils::DEVICE_CPU)),
MultiplyAddLayerTest::getTestCaseName);
} // namespace

View File

@ -4,91 +4,75 @@
#include "subgraph_tests/mvn_multiply_add.hpp"
using namespace SubgraphTestsDefinitions;
using namespace InferenceEngine;
using namespace ov::test;
namespace {
const std::vector<Precision> netPrecision = {
Precision::FP32
const std::vector<ov::element::Type> netPrecision = {ov::element::f32};
std::vector<ov::element::Type> idxPrecision = {ov::element::i64};
const std::vector<bool> acrossChannels = {true, false};
const std::vector<bool> normalizeVariance = {true, false};
const std::vector<float> epsilon = {0.000000001f};
const std::vector<std::string> epsMode = {"inside_sqrt", "outside_sqrt"};
const std::vector<std::pair<ov::Shape, ov::Shape>> shapes_1D = {
std::pair<ov::Shape, ov::Shape>{ov::Shape{5}, ov::Shape{5}},
std::pair<ov::Shape, ov::Shape>{ov::Shape{64}, ov::Shape{64}},
};
std::vector<Precision> idxPrecision = {
Precision::I64
const std::vector<std::pair<ov::Shape, ov::Shape>> shapes_2D = {
std::pair<ov::Shape, ov::Shape>{ov::Shape{1, 5}, ov::Shape{1, 5}},
std::pair<ov::Shape, ov::Shape>{ov::Shape{2, 17}, ov::Shape{1, 17}},
std::pair<ov::Shape, ov::Shape>{ov::Shape{9, 64}, ov::Shape{1, 64}},
std::pair<ov::Shape, ov::Shape>{ov::Shape{5, 15}, ov::Shape{1, 15}},
};
const std::vector<bool> acrossChannels = {
true,
false
const std::vector<std::pair<ov::Shape, ov::Shape>> shapes_3D = {
std::pair<ov::Shape, ov::Shape>{ov::Shape{1, 5, 8}, ov::Shape{1, 5, 8}},
std::pair<ov::Shape, ov::Shape>{ov::Shape{2, 17, 9}, ov::Shape{1, 1, 9}},
std::pair<ov::Shape, ov::Shape>{ov::Shape{1, 1, 10}, ov::Shape{1, 1, 10}},
std::pair<ov::Shape, ov::Shape>{ov::Shape{2, 3, 3}, ov::Shape{2, 3, 3}},
};
const std::vector<bool> normalizeVariance = {
true,
false
};
INSTANTIATE_TEST_SUITE_P(smoke_MVNMultiplyAdd_1D,
MVNMultiplyAdd,
::testing::Combine(::testing::ValuesIn(shapes_1D),
::testing::ValuesIn(netPrecision),
::testing::ValuesIn(idxPrecision),
::testing::Values(std::vector<int>{0}),
::testing::ValuesIn(normalizeVariance),
::testing::ValuesIn(epsilon),
::testing::ValuesIn(epsMode),
::testing::Values(ov::test::utils::DEVICE_CPU)),
MVNMultiplyAdd::getTestCaseName);
const std::vector<float> epsilon = {
0.000000001f
};
INSTANTIATE_TEST_SUITE_P(smoke_MVNMultiplyAdd_2D,
MVNMultiplyAdd,
::testing::Combine(::testing::ValuesIn(shapes_2D),
::testing::ValuesIn(netPrecision),
::testing::ValuesIn(idxPrecision),
::testing::Values(std::vector<int>{1}),
::testing::ValuesIn(normalizeVariance),
::testing::ValuesIn(epsilon),
::testing::ValuesIn(epsMode),
::testing::Values(ov::test::utils::DEVICE_CPU)),
MVNMultiplyAdd::getTestCaseName);
const std::vector<std::string> epsMode = {
"inside_sqrt",
"outside_sqrt"
};
const std::vector<std::pair<SizeVector, SizeVector>> shapes_1D = {
std::pair<SizeVector, SizeVector>{ SizeVector{5}, SizeVector{5}},
std::pair<SizeVector, SizeVector>{ SizeVector{64}, SizeVector{64}},
};
const std::vector<std::pair<SizeVector, SizeVector>> shapes_2D = {
std::pair<SizeVector, SizeVector>{ SizeVector{1, 5}, SizeVector{1, 5}},
std::pair<SizeVector, SizeVector>{ SizeVector{2, 17}, SizeVector{1, 17}},
std::pair<SizeVector, SizeVector>{ SizeVector{9, 64}, SizeVector{1, 64}},
std::pair<SizeVector, SizeVector>{ SizeVector{5, 15}, SizeVector{1, 15}},
};
const std::vector<std::pair<SizeVector, SizeVector>> shapes_3D = {
std::pair<SizeVector, SizeVector>{ SizeVector{1, 5, 8}, SizeVector{1, 5, 8}},
std::pair<SizeVector, SizeVector>{ SizeVector{2, 17, 9}, SizeVector{1, 1, 9}},
std::pair<SizeVector, SizeVector>{ SizeVector{1, 1, 10}, SizeVector{1, 1, 10}},
std::pair<SizeVector, SizeVector>{ SizeVector{2, 3, 3}, SizeVector{2, 3, 3}},
};
INSTANTIATE_TEST_SUITE_P(smoke_MVNMultiplyAdd_1D, MVNMultiplyAdd,
::testing::Combine(
::testing::ValuesIn(shapes_1D),
::testing::ValuesIn(netPrecision),
::testing::ValuesIn(idxPrecision),
::testing::Values(std::vector<int>{0}),
::testing::ValuesIn(normalizeVariance),
::testing::ValuesIn(epsilon),
::testing::ValuesIn(epsMode),
::testing::Values(ov::test::utils::DEVICE_CPU)),
MVNMultiplyAdd::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_MVNMultiplyAdd_2D, MVNMultiplyAdd,
::testing::Combine(
::testing::ValuesIn(shapes_2D),
::testing::ValuesIn(netPrecision),
::testing::ValuesIn(idxPrecision),
::testing::Values(std::vector<int>{1}),
::testing::ValuesIn(normalizeVariance),
::testing::ValuesIn(epsilon),
::testing::ValuesIn(epsMode),
::testing::Values(ov::test::utils::DEVICE_CPU)),
MVNMultiplyAdd::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_MVNMultiplyAdd_3D, MVNMultiplyAdd,
::testing::Combine(
::testing::ValuesIn(shapes_3D),
::testing::ValuesIn(netPrecision),
::testing::ValuesIn(idxPrecision),
::testing::Values(std::vector<int>{2}),
::testing::ValuesIn(normalizeVariance),
::testing::ValuesIn(epsilon),
::testing::ValuesIn(epsMode),
::testing::Values(ov::test::utils::DEVICE_CPU)),
MVNMultiplyAdd::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_MVNMultiplyAdd_3D,
MVNMultiplyAdd,
::testing::Combine(::testing::ValuesIn(shapes_3D),
::testing::ValuesIn(netPrecision),
::testing::ValuesIn(idxPrecision),
::testing::Values(std::vector<int>{2}),
::testing::ValuesIn(normalizeVariance),
::testing::ValuesIn(epsilon),
::testing::ValuesIn(epsMode),
::testing::Values(ov::test::utils::DEVICE_CPU)),
MVNMultiplyAdd::getTestCaseName);
} // namespace

View File

@ -11,12 +11,6 @@ using namespace ov::test;
namespace {
INSTANTIATE_TEST_SUITE_P(smoke_Check,
ParameterResultSubgraphTestLegacyApi,
::testing::Combine(::testing::Values(ov::test::InputShape{{1, 3, 10, 10}, {}}),
::testing::Values(ov::test::utils::DEVICE_CPU)),
ParameterResultSubgraphTestBase::getTestCaseName);
const std::vector<ov::test::InputShape> inputShapes = {
ov::test::InputShape{{1, 3, 10, 10}, {{1, 3, 10, 10}, {1, 3, 10, 10}}},
ov::test::InputShape{{-1, -1, -1, -1}, {{1, 3, 10, 10}, {2, 5, 3, 10}, {1, 3, 10, 10}, {1, 3, 10, 10}}},

View File

@ -2,42 +2,45 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "subgraph_tests/perm_conv_perm_concat.hpp"
#include "common_test_utils/test_constants.hpp"
#include <vector>
namespace {
std::vector<std::array<size_t, 4>> input_shapes {
std::vector<ov::Shape> input_shapes{
{1, 1, 7, 32},
{1, 1, 8, 16},
};
std::vector<std::array<size_t, 2>> kernel_shapes {
std::vector<ov::Shape> kernel_shapes{
{1, 3},
{1, 5},
};
std::vector<size_t> output_channels {
std::vector<size_t> output_channels{
32,
64,
};
std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16,
std::vector<ov::element::Type> netPrecisions = {
ov::element::f32,
ov::element::f16,
};
std::map<std::string, std::string> additional_config = {
};
} // namespace
ov::AnyMap additional_config = {};
} // namespace
namespace SubgraphTestsDefinitions {
INSTANTIATE_TEST_SUITE_P(smoke_basic, PermConvPermConcat,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(ov::test::utils::DEVICE_CPU),
::testing::ValuesIn(input_shapes),
::testing::ValuesIn(kernel_shapes),
::testing::ValuesIn(output_channels),
::testing::Values(additional_config)),
PermConvPermConcat::getTestCaseName);
} // namespace SubgraphTestsDefinitions
namespace ov {
namespace test {
INSTANTIATE_TEST_SUITE_P(smoke_basic,
PermConvPermConcat,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(ov::test::utils::DEVICE_CPU),
::testing::ValuesIn(input_shapes),
::testing::ValuesIn(kernel_shapes),
::testing::ValuesIn(output_channels),
::testing::Values(additional_config)),
PermConvPermConcat::getTestCaseName);
} // namespace test
} // namespace ov

View File

@ -1,45 +0,0 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "subgraph_tests/perm_conv_perm_concat.hpp"
#include <vector>
#include "common_test_utils/test_constants.hpp"
namespace {
std::vector<std::array<size_t, 4>> input_shapes{
{1, 1, 7, 32},
{1, 1, 8, 16},
};
std::vector<std::array<size_t, 2>> kernel_shapes{
{1, 3},
{1, 5},
};
std::vector<size_t> output_channels{
32,
64,
};
std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16,
};
std::vector<std::map<std::string, std::string>> configs = {{{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}},
{{"GNA_DEVICE_MODE", "GNA_SW_FP32"}}};
} // namespace
namespace SubgraphTestsDefinitions {
INSTANTIATE_TEST_SUITE_P(smoke_basic,
PermConvPermConcat,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(ov::test::utils::DEVICE_GNA),
::testing::ValuesIn(input_shapes),
::testing::ValuesIn(kernel_shapes),
::testing::ValuesIn(output_channels),
::testing::ValuesIn(configs)),
PermConvPermConcat::getTestCaseName);
} // namespace SubgraphTestsDefinitions

View File

@ -2,32 +2,29 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "subgraph_tests/multiply_add.hpp"
using namespace SubgraphTestsDefinitions;
#include <vector>
using namespace ov::test;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16
const std::vector<ov::element::Type> input_type = {ov::element::f32, ov::element::f16};
const std::vector<ov::Shape> inputShapes = {
{1, 3},
{1, 3, 2},
{1, 3, 2, 5},
{1, 3, 2, 5, 4},
{1, 3, 2, 2, 4, 5},
};
const std::vector<std::vector<size_t>> inputShapes = {
{1, 3},
{1, 3, 2},
{1, 3, 2, 5},
{1, 3, 2, 5, 4},
{1, 3, 2, 2, 4, 5},
};
INSTANTIATE_TEST_SUITE_P(smoke_MultipleAdd_Nd, MultiplyAddLayerTest,
::testing::Combine(
::testing::ValuesIn(inputShapes),
::testing::ValuesIn(netPrecisions),
::testing::Values(ov::test::utils::DEVICE_GPU)),
MultiplyAddLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_MultipleAdd_Nd,
MultiplyAddLayerTest,
::testing::Combine(::testing::ValuesIn(inputShapes),
::testing::ValuesIn(input_type),
::testing::Values(ov::test::utils::DEVICE_GPU)),
MultiplyAddLayerTest::getTestCaseName);
} // namespace

View File

@ -2,42 +2,41 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include "subgraph_tests/perm_conv_perm_concat.hpp"
#include "common_test_utils/test_constants.hpp"
#include <vector>
namespace {
std::vector<std::array<size_t, 4>> input_shapes {
std::vector<ov::Shape> input_shapes{
{1, 1, 7, 32},
{1, 1, 8, 16},
};
std::vector<std::array<size_t, 2>> kernel_shapes {
std::vector<ov::Shape> kernel_shapes{
{1, 3},
{1, 5},
};
std::vector<size_t> output_channels {
std::vector<size_t> output_channels{
32,
64,
};
std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
// InferenceEngine::Precision::FP16,
};
std::vector<ov::element::Type> netPrecisions = {ov::element::f32};
std::map<std::string, std::string> additional_config = {
};
} // namespace
ov::AnyMap additional_config = {};
} // namespace
namespace SubgraphTestsDefinitions {
INSTANTIATE_TEST_SUITE_P(smoke_basic, PermConvPermConcat,
::testing::Combine(
::testing::ValuesIn(netPrecisions),
::testing::Values(ov::test::utils::DEVICE_GPU),
::testing::ValuesIn(input_shapes),
::testing::ValuesIn(kernel_shapes),
::testing::ValuesIn(output_channels),
::testing::Values(additional_config)),
PermConvPermConcat::getTestCaseName);
} // namespace SubgraphTestsDefinitions
namespace ov {
namespace test {
INSTANTIATE_TEST_SUITE_P(smoke_basic,
PermConvPermConcat,
::testing::Combine(::testing::ValuesIn(netPrecisions),
::testing::Values(ov::test::utils::DEVICE_GPU),
::testing::ValuesIn(input_shapes),
::testing::ValuesIn(kernel_shapes),
::testing::ValuesIn(output_channels),
::testing::Values(additional_config)),
PermConvPermConcat::getTestCaseName);
} // namespace test
} // namespace ov

View File

@ -6,9 +6,12 @@
#include "shared_test_classes/subgraph/mul_conv_fusion.hpp"
namespace SubgraphTestsDefinitions {
namespace ov {
namespace test {
TEST_P(MulConvFusion, CompareWithRefs) {
Run();
run();
}
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov

View File

@ -6,10 +6,12 @@
#include "shared_test_classes/subgraph/multiply_add.hpp"
namespace SubgraphTestsDefinitions {
namespace ov {
namespace test {
TEST_P(MultiplyAddLayerTest, CompareWithRefs) {
Run();
run();
};
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov

View File

@ -6,10 +6,12 @@
#include "shared_test_classes/subgraph/mvn_multiply_add.hpp"
namespace SubgraphTestsDefinitions {
namespace ov {
namespace test {
TEST_P(MVNMultiplyAdd, CompareWithRefs){
Run();
TEST_P(MVNMultiplyAdd, CompareWithRefs) {
run();
};
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov

View File

@ -6,10 +6,12 @@
#include "shared_test_classes/subgraph/perm_conv_perm_concat.hpp"
namespace SubgraphTestsDefinitions {
namespace ov {
namespace test {
TEST_P(PermConvPermConcat, CompareWithRefs) {
Run();
run();
}
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov

View File

@ -4,32 +4,33 @@
#pragma once
#include <tuple>
#include <string>
#include <tuple>
#include <vector>
#include "shared_test_classes/base/layer_test_utils.hpp"
#include <ngraph/shape.hpp>
#include <ngraph/node.hpp>
namespace SubgraphTestsDefinitions {
#include "shared_test_classes/base/ov_subgraph.hpp"
typedef std::tuple<
ngraph::NodeTypeInfo, // Convolution type
ngraph::Shape, // Input shape
ngraph::Shape, // Weights shape
ngraph::Shape, // Const shape
ngraph::element::Type, // Network precision
bool, // True if test is negative
std::string // Device name
> MulConvFusionParams;
namespace ov {
namespace test {
class MulConvFusion
: public testing::WithParamInterface<MulConvFusionParams>,
virtual public LayerTestsUtils::LayerTestsCommon {
typedef std::tuple<ov::NodeTypeInfo, // Convolution type
ov::Shape, // Input shape
ov::Shape, // Weights shape
ov::Shape, // Const shape
ov::element::Type, // Network precision
bool, // True if test is negative
std::string // Device name
>
MulConvFusionParams;
class MulConvFusion : public testing::WithParamInterface<MulConvFusionParams>,
virtual public ov::test::SubgraphBaseStaticTest {
public:
static std::string getTestCaseName(const testing::TestParamInfo<MulConvFusionParams> &obj);
static std::string getTestCaseName(const testing::TestParamInfo<MulConvFusionParams>& obj);
protected:
void SetUp() override;
};
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov

View File

@ -4,30 +4,28 @@
#pragma once
#include <tuple>
#include <string>
#include <vector>
#include <memory>
#include "shared_test_classes/base/layer_test_utils.hpp"
#include "ov_models/builders.hpp"
#include "ov_models/utils/ov_helpers.hpp"
#include "common_test_utils/test_constants.hpp"
#include <string>
#include <tuple>
#include <vector>
namespace SubgraphTestsDefinitions {
#include "shared_test_classes/base/ov_subgraph.hpp"
using MultiplyAddParamsTuple = typename std::tuple<
std::vector<size_t>, //input shapes
InferenceEngine::Precision, //Network precision
std::string>; //Device name
namespace ov {
namespace test {
class MultiplyAddLayerTest:
public testing::WithParamInterface<MultiplyAddParamsTuple>,
virtual public LayerTestsUtils::LayerTestsCommon{
using MultiplyAddParamsTuple = typename std::tuple<ov::Shape, // input shapes
ov::element::Type, // Input precision
std::string>; // Device name
class MultiplyAddLayerTest : public testing::WithParamInterface<MultiplyAddParamsTuple>,
virtual public ov::test::SubgraphBaseStaticTest {
public:
std::shared_ptr<ngraph::Function> fn;
static std::string getTestCaseName(const testing::TestParamInfo<MultiplyAddParamsTuple> &obj);
static std::string getTestCaseName(const testing::TestParamInfo<MultiplyAddParamsTuple>& obj);
protected:
void SetUp() override;
};
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov

View File

@ -4,31 +4,34 @@
#pragma once
#include <tuple>
#include <string>
#include <tuple>
#include <vector>
#include "shared_test_classes/base/layer_test_utils.hpp"
#include "ov_models/builders.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp"
namespace SubgraphTestsDefinitions {
namespace ov {
namespace test {
typedef std::tuple<
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector>, // Input shape, Constant shape
InferenceEngine::Precision, // Data precision
InferenceEngine::Precision, // Axes precision
std::vector<int>, // Axes
bool, // Normalize variance
float, // Epsilon
std::string, // Epsilon mode
std::string // Device name
> mvnMultiplyAddParams;
typedef std::tuple<std::pair<ov::Shape, ov::Shape>, // Input shape, Constant shape
ov::element::Type, // Data precision
ov::element::Type, // Axes precision
std::vector<int>, // Axes
bool, // Normalize variance
float, // Epsilon
std::string, // Epsilon mode
std::string // Device name
>
mvnMultiplyAddParams;
class MVNMultiplyAdd: public testing::WithParamInterface<mvnMultiplyAddParams>,
virtual public LayerTestsUtils::LayerTestsCommon{
class MVNMultiplyAdd : public testing::WithParamInterface<mvnMultiplyAddParams>,
virtual public ov::test::SubgraphBaseStaticTest {
public:
static std::string getTestCaseName(const testing::TestParamInfo<mvnMultiplyAddParams> &obj);
static std::string getTestCaseName(const testing::TestParamInfo<mvnMultiplyAddParams>& obj);
protected:
void SetUp() override;
};
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov

View File

@ -5,32 +5,29 @@
#pragma once
#include <tuple>
#include <vector>
#include <array>
#include <string>
#include <memory>
#include "shared_test_classes/base/layer_test_utils.hpp"
#include "ov_models/utils/ov_helpers.hpp"
#include "ov_models/builders.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp"
namespace SubgraphTestsDefinitions {
typedef std::tuple<
InferenceEngine::Precision, // Network Precision
std::string, // Target Device
std::array<size_t, 4>, // Input shape
std::array<size_t, 2>, // Kernel shape
size_t, // Output channels
std::map<std::string, std::string> // Configuration
> PermConvPermConcatParams;
namespace ov {
namespace test {
typedef std::tuple<ov::element::Type, // Network Precision
std::string, // Target Device
ov::Shape, // Input shape
ov::Shape, // Kernel shape
size_t, // Output channels
ov::AnyMap // Configuration
>
PermConvPermConcatParams;
class PermConvPermConcat : public testing::WithParamInterface<PermConvPermConcatParams>,
virtual public LayerTestsUtils::LayerTestsCommon {
virtual public ov::test::SubgraphBaseStaticTest {
public:
static std::string getTestCaseName(const testing::TestParamInfo<PermConvPermConcatParams>& obj);
protected:
void SetUp() override;
void Run() override;
};
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov

View File

@ -2,17 +2,20 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "transformations/common_optimizations/mul_conv_fusion.hpp"
#include "ngraph/pass/constant_folding.hpp"
#include "shared_test_classes/subgraph/mul_conv_fusion.hpp"
#include "common_test_utils/graph_comparator.hpp"
#include "openvino/pass/manager.hpp"
#include "ov_models/builders.hpp"
#include "transformations/common_optimizations/mul_conv_fusion.hpp"
namespace SubgraphTestsDefinitions {
namespace ov {
namespace test {
std::string MulConvFusion::getTestCaseName(const testing::TestParamInfo<MulConvFusionParams> &obj) {
ngraph::NodeTypeInfo conv_type;
ngraph::Shape input_shape, weights_shape, const_shape;
ngraph::element::Type precision;
std::string MulConvFusion::getTestCaseName(const testing::TestParamInfo<MulConvFusionParams>& obj) {
ov::NodeTypeInfo conv_type;
ov::Shape input_shape, weights_shape, const_shape;
ov::element::Type precision;
std::string device;
std::tie(conv_type, input_shape, weights_shape, const_shape, precision, std::ignore, device) = obj.param;
std::ostringstream results;
@ -27,36 +30,43 @@ std::string MulConvFusion::getTestCaseName(const testing::TestParamInfo<MulConvF
}
void MulConvFusion::SetUp() {
ngraph::NodeTypeInfo conv_type;
ngraph::Shape input_shape, weights_shape, const_shape;
ngraph::element::Type precision;
ov::NodeTypeInfo conv_type;
ov::Shape input_shape, weights_shape, const_shape;
ov::element::Type precision;
bool is_negative;
std::tie(conv_type, input_shape, weights_shape, const_shape, precision, is_negative, targetDevice) = this->GetParam();
auto param = std::make_shared<ngraph::opset8::Parameter>(precision, input_shape);
std::tie(conv_type, input_shape, weights_shape, const_shape, precision, is_negative, targetDevice) =
this->GetParam();
auto param = std::make_shared<ov::op::v0::Parameter>(precision, input_shape);
auto spatial_dims = input_shape.size() - 2;
auto mul_const = ngraph::builder::makeConstant<float>(precision, const_shape, {}, true);
auto mul = std::make_shared<ngraph::opset8::Multiply>(param, mul_const);
ngraph::Shape strides(spatial_dims, 1);
auto mul = std::make_shared<ov::op::v1::Multiply>(param, mul_const);
ov::Shape strides(spatial_dims, 1);
std::vector<ptrdiff_t> pad_begin(spatial_dims, 0), pad_end(spatial_dims, 0);
auto weights = ngraph::builder::makeConstant<float>(precision, weights_shape, {}, true);
std::shared_ptr<ngraph::Node> conv;
if (conv_type == ngraph::opset8::Convolution::get_type_info_static()) {
conv = std::make_shared<ngraph::opset8::Convolution>(mul, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == ngraph::opset8::GroupConvolution::get_type_info_static()) {
conv = std::make_shared<ngraph::opset8::GroupConvolution>(mul, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == ngraph::opset8::ConvolutionBackpropData::get_type_info_static()) {
conv = std::make_shared<ngraph::opset8::ConvolutionBackpropData>(mul, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == ngraph::opset8::GroupConvolutionBackpropData::get_type_info_static()) {
conv = std::make_shared<ngraph::opset8::GroupConvolutionBackpropData>(mul, weights, strides, pad_begin, pad_end, strides);
std::shared_ptr<ov::Node> conv;
if (conv_type == ov::op::v1::Convolution::get_type_info_static()) {
conv = std::make_shared<ov::op::v1::Convolution>(mul, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == ov::op::v1::GroupConvolution::get_type_info_static()) {
conv = std::make_shared<ov::op::v1::GroupConvolution>(mul, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == ov::op::v1::ConvolutionBackpropData::get_type_info_static()) {
conv =
std::make_shared<ov::op::v1::ConvolutionBackpropData>(mul, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == ov::op::v1::GroupConvolutionBackpropData::get_type_info_static()) {
conv = std::make_shared<ov::op::v1::GroupConvolutionBackpropData>(mul,
weights,
strides,
pad_begin,
pad_end,
strides);
} else {
OPENVINO_THROW("Unsupported type");
}
function = std::make_shared<ngraph::Function>(ngraph::OutputVector{conv}, ngraph::ParameterVector{param});
auto cloned_function = ngraph::clone_function(*function);
function = std::make_shared<ov::Model>(ov::OutputVector{conv}, ov::ParameterVector{param});
auto cloned_function = function->clone();
ngraph::pass::Manager manager;
ov::pass::Manager manager;
manager.register_pass<ov::pass::MultiplyConvolutionFusion>();
manager.register_pass<ov::pass::MultiplyGroupConvolutionFusion>();
manager.register_pass<ov::pass::MultiplyConvolutionBackpropDataFusion>();
@ -65,58 +75,75 @@ void MulConvFusion::SetUp() {
bool functions_equal = false;
if (!is_negative) {
auto param = std::make_shared<ngraph::opset8::Parameter>(precision, input_shape);
ngraph::Shape strides(spatial_dims, 1);
auto param = std::make_shared<ov::op::v0::Parameter>(precision, input_shape);
ov::Shape strides(spatial_dims, 1);
std::vector<ptrdiff_t> pad_begin(spatial_dims, 0), pad_end(spatial_dims, 0);
std::shared_ptr<ngraph::Node> conv;
if (conv_type == ngraph::opset8::Convolution::get_type_info_static()) {
weights = std::make_shared<ngraph::opset8::Multiply>(weights, mul_const);
std::shared_ptr<ov::Node> conv;
if (conv_type == ov::op::v1::Convolution::get_type_info_static()) {
weights = std::make_shared<ov::op::v1::Multiply>(weights, mul_const);
weights = ov::get_constant_from_source(weights);
ASSERT_NE(nullptr, weights);
conv = std::make_shared<ngraph::opset8::Convolution>(param, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == ngraph::opset8::GroupConvolution::get_type_info_static()) {
conv = std::make_shared<ov::op::v1::Convolution>(param, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == ov::op::v1::GroupConvolution::get_type_info_static()) {
const_shape.insert(const_shape.begin(), weights_shape.size() - const_shape.size(), 1);
auto G = const_shape[2] > 1 ? weights_shape[0] : 1;
const_shape[0] = G;
const_shape[2] /= G;
auto reshape = std::make_shared<ngraph::opset8::Reshape>(mul_const,
ngraph::op::Constant::create(ngraph::element::u64, ngraph::Shape{const_shape.size()}, const_shape), false);
weights = std::make_shared<ngraph::opset8::Multiply>(weights, reshape);
auto reshape = std::make_shared<ov::op::v1::Reshape>(
mul_const,
ov::op::v0::Constant::create(ov::element::u64, ov::Shape{const_shape.size()}, const_shape),
false);
weights = std::make_shared<ov::op::v1::Multiply>(weights, reshape);
weights = ov::get_constant_from_source(weights);
ASSERT_NE(nullptr, weights);
conv = std::make_shared<ngraph::opset8::GroupConvolution>(param, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == ngraph::opset8::ConvolutionBackpropData::get_type_info_static()) {
conv = std::make_shared<ov::op::v1::GroupConvolution>(param, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == ov::op::v1::ConvolutionBackpropData::get_type_info_static()) {
const_shape.insert(const_shape.begin(), weights_shape.size() - const_shape.size(), 1);
const_shape[0] = const_shape[1];
const_shape[1] = 1;
auto reshape = std::make_shared<ngraph::opset8::Reshape>(mul_const,
ngraph::op::Constant::create(ngraph::element::u64, ngraph::Shape{const_shape.size()}, const_shape), false);
weights = std::make_shared<ngraph::opset8::Multiply>(weights, reshape);
auto reshape = std::make_shared<ov::op::v1::Reshape>(
mul_const,
ov::op::v0::Constant::create(ov::element::u64, ov::Shape{const_shape.size()}, const_shape),
false);
weights = std::make_shared<ov::op::v1::Multiply>(weights, reshape);
weights = ov::get_constant_from_source(weights);
ASSERT_NE(nullptr, weights);
conv = std::make_shared<ngraph::opset8::ConvolutionBackpropData>(param, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == ngraph::opset8::GroupConvolutionBackpropData::get_type_info_static()) {
conv = std::make_shared<ov::op::v1::ConvolutionBackpropData>(param,
weights,
strides,
pad_begin,
pad_end,
strides);
} else if (conv_type == ov::op::v1::GroupConvolutionBackpropData::get_type_info_static()) {
const_shape.insert(const_shape.begin(), weights_shape.size() - const_shape.size(), 1);
auto G = const_shape[2] > 1 ? weights_shape[0] : 1;
const_shape[0] = G;
const_shape[1] = const_shape[2] / G;
const_shape[2] = 1;
auto reshape = std::make_shared<ngraph::opset8::Reshape>(mul_const,
ngraph::op::Constant::create(ngraph::element::u64, ngraph::Shape{const_shape.size()}, const_shape), false);
weights = std::make_shared<ngraph::opset8::Multiply>(weights, reshape);
auto reshape = std::make_shared<ov::op::v1::Reshape>(
mul_const,
ov::op::v0::Constant::create(ov::element::u64, ov::Shape{const_shape.size()}, const_shape),
false);
weights = std::make_shared<ov::op::v1::Multiply>(weights, reshape);
weights = ov::get_constant_from_source(weights);
ASSERT_NE(nullptr, weights);
conv = std::make_shared<ngraph::opset8::GroupConvolutionBackpropData>(param, weights, strides, pad_begin, pad_end, strides);
conv = std::make_shared<ov::op::v1::GroupConvolutionBackpropData>(param,
weights,
strides,
pad_begin,
pad_end,
strides);
} else {
OPENVINO_THROW("Unsupported type");
}
auto reference_function = std::make_shared<ngraph::Function>(ngraph::OutputVector{conv}, ngraph::ParameterVector{param});
auto reference_function = std::make_shared<ov::Model>(ov::OutputVector{conv}, ov::ParameterVector{param});
std::tie(functions_equal, std::ignore) = compare_functions(cloned_function, reference_function, true);
ASSERT_TRUE(functions_equal);
} else {
auto reference_function = ngraph::clone_function(*function);
auto reference_function = function->clone();
std::tie(functions_equal, std::ignore) = compare_functions(cloned_function, reference_function, true);
ASSERT_TRUE(functions_equal);
}
}
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov

View File

@ -4,37 +4,43 @@
#include "shared_test_classes/subgraph/multiply_add.hpp"
namespace SubgraphTestsDefinitions {
std::string MultiplyAddLayerTest::getTestCaseName(const testing::TestParamInfo<MultiplyAddParamsTuple> &obj) {
std::vector<size_t> inputShapes;
InferenceEngine::Precision netPrecision;
#include "ov_models/builders.hpp"
#include "ov_models/utils/ov_helpers.hpp"
namespace ov {
namespace test {
std::string MultiplyAddLayerTest::getTestCaseName(const testing::TestParamInfo<MultiplyAddParamsTuple>& obj) {
ov::Shape inputShapes;
ov::element::Type element_type;
std::string targetName;
std::tie(inputShapes, netPrecision, targetName) = obj.param;
std::tie(inputShapes, element_type, targetName) = obj.param;
std::ostringstream results;
results << "IS=" << ov::test::utils::vec2str(inputShapes) << "_";
results << "netPRC=" << netPrecision.name() << "_";
results << "ET=" << element_type << "_";
results << "targetDevice=" << targetName << "_";
return results.str();
}
void MultiplyAddLayerTest::SetUp() {
std::vector<size_t> inputShape;
auto netPrecision = InferenceEngine::Precision::UNSPECIFIED;
std::tie(inputShape, netPrecision, targetDevice) = this->GetParam();
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
ov::ParameterVector params{std::make_shared<ov::op::v0::Parameter>(ngPrc, ov::Shape(inputShape))};
auto paramOuts = ngraph::helpers::convert2OutputVector(
ngraph::helpers::castOps2Nodes<ngraph::op::Parameter>(params));
ov::Shape inputShape;
ov::element::Type element_type;
std::tie(inputShape, element_type, targetDevice) = this->GetParam();
ov::ParameterVector params{std::make_shared<ov::op::v0::Parameter>(element_type, ov::PartialShape(inputShape))};
auto paramOuts =
ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes<ov::op::v0::Parameter>(params));
std::vector<size_t> constShape(inputShape.size(), 1);
constShape[1] = inputShape[1];
auto const_mul = ngraph::builder::makeConstant<float>(ngPrc, constShape, {}, true);
auto mul = std::make_shared<ngraph::opset3::Multiply>(paramOuts[0], const_mul);
auto const_add = ngraph::builder::makeConstant<float>(ngPrc, constShape, {}, true);
auto add = std::make_shared<ngraph::opset3::Add>(mul, const_add);
ngraph::ResultVector results{std::make_shared<ngraph::opset3::Result>(add)};
function = std::make_shared<ngraph::Function>(results, params, "multiplyAdd");
auto const_mul = ngraph::builder::makeConstant<float>(element_type, constShape, {}, true);
auto mul = std::make_shared<ov::op::v1::Multiply>(paramOuts[0], const_mul);
auto const_add = ngraph::builder::makeConstant<float>(element_type, constShape, {}, true);
auto add = std::make_shared<ov::op::v1::Add>(mul, const_add);
ov::ResultVector results{std::make_shared<ov::op::v0::Result>(add)};
function = std::make_shared<ov::Model>(results, params, "multiplyAdd");
}
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov

View File

@ -4,12 +4,16 @@
#include "shared_test_classes/subgraph/mvn_multiply_add.hpp"
namespace SubgraphTestsDefinitions {
#include "ov_models/builders.hpp"
#include "ov_models/utils/ov_helpers.hpp"
std::string MVNMultiplyAdd::getTestCaseName(const testing::TestParamInfo<mvnMultiplyAddParams> &obj) {
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector> shapes;
InferenceEngine::SizeVector inputShapes, constantShapes;
InferenceEngine::Precision dataPrecision, axesPrecision;
namespace ov {
namespace test {
std::string MVNMultiplyAdd::getTestCaseName(const testing::TestParamInfo<mvnMultiplyAddParams>& obj) {
std::pair<ov::Shape, ov::Shape> shapes;
ov::Shape inputShapes, constantShapes;
ov::element::Type dataPrecision, axesPrecision;
std::vector<int> axes;
bool normalizeVariance;
float eps;
@ -20,8 +24,8 @@ std::string MVNMultiplyAdd::getTestCaseName(const testing::TestParamInfo<mvnMult
std::ostringstream result;
result << "IS=" << ov::test::utils::vec2str(inputShapes) << "_";
result << "CS=" << ov::test::utils::vec2str(constantShapes) << "_";
result << "DataPrc=" << dataPrecision.name() << "_";
result << "AxPrc=" << axesPrecision.name() << "_";
result << "DataET=" << dataPrecision << "_";
result << "AxET=" << axesPrecision << "_";
result << "Ax=" << ov::test::utils::vec2str(axes) << "_";
result << "NormVariance=" << (normalizeVariance ? "TRUE" : "FALSE") << "_";
result << "Eps=" << eps << "_";
@ -31,29 +35,29 @@ std::string MVNMultiplyAdd::getTestCaseName(const testing::TestParamInfo<mvnMult
}
void MVNMultiplyAdd::SetUp() {
std::pair<InferenceEngine::SizeVector, InferenceEngine::SizeVector> shapes;
InferenceEngine::SizeVector inputShapes, constantShapes;
InferenceEngine::Precision dataPrecision, axesPrecision;
std::pair<ov::Shape, ov::Shape> shapes;
ov::Shape inputShapes, constantShapes;
ov::element::Type dataType, axesType;
std::vector<int> axes;
bool normalizeVariance;
float eps;
std::string epsMode;
std::tie(shapes, dataPrecision, axesPrecision, axes, normalizeVariance, eps, epsMode, targetDevice) = this->GetParam();
std::tie(shapes, dataType, axesType, axes, normalizeVariance, eps, epsMode, targetDevice) = this->GetParam();
std::tie(inputShapes, constantShapes) = shapes;
auto dataType = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(dataPrecision);
auto axesType = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(axesPrecision);
ov::ParameterVector param {std::make_shared<ov::op::v0::Parameter>(dataType, ov::Shape(inputShapes))};
auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes<ngraph::op::Parameter>(param));
auto axesNode = ngraph::builder::makeConstant(axesType, ngraph::Shape{axes.size()}, axes);
ov::ParameterVector param{std::make_shared<ov::op::v0::Parameter>(dataType, ov::Shape(inputShapes))};
auto paramOuts =
ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes<ov::op::v0::Parameter>(param));
auto axesNode = ngraph::builder::makeConstant(axesType, ov::Shape{axes.size()}, axes);
auto mvn = ngraph::builder::makeMVN6(paramOuts[0], axesNode, normalizeVariance, eps, epsMode);
auto gamma = ngraph::builder::makeConstant<float>(dataType, constantShapes, {}, true);
auto mul = std::make_shared<ngraph::opset7::Multiply>(mvn, gamma);
auto mul = std::make_shared<ov::op::v1::Multiply>(mvn, gamma);
auto beta = ngraph::builder::makeConstant<float>(dataType, constantShapes, {}, true);
auto add = std::make_shared<ngraph::opset7::Add>(mul, beta);
auto add = std::make_shared<ov::op::v1::Add>(mul, beta);
ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(add)};
function = std::make_shared<ngraph::Function>(results, param, "MVNMultiplyAdd");
ov::ResultVector results{std::make_shared<ov::op::v0::Result>(add)};
function = std::make_shared<ov::Model>(results, param, "MVNMultiplyAdd");
}
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov

View File

@ -4,105 +4,97 @@
#include "shared_test_classes/subgraph/perm_conv_perm_concat.hpp"
namespace SubgraphTestsDefinitions {
#include "common_test_utils/data_utils.hpp"
#include "functional_test_utils/skip_tests_config.hpp"
#include "ov_models/builders.hpp"
namespace ov {
namespace test {
std::string PermConvPermConcat::getTestCaseName(const testing::TestParamInfo<PermConvPermConcatParams>& obj) {
InferenceEngine::Precision netPrecision;
ov::element::Type element_type;
std::string targetName;
std::array<size_t, 4> input_shape;
std::array<size_t, 2> kernel_shape;
ov::Shape input_shape;
ov::Shape kernel_shape;
size_t output_channels;
std::map<std::string, std::string> configuration;
ov::AnyMap configuration;
std::tie(netPrecision, targetName, input_shape, kernel_shape, output_channels, configuration) = obj.param;
std::tie(element_type, targetName, input_shape, kernel_shape, output_channels, configuration) = obj.param;
std::ostringstream results;
results << "IS=" << ov::test::utils::vec2str(std::vector<size_t>(input_shape.begin(), input_shape.end())) << "_";
results << "KS=" << ov::test::utils::vec2str(std::vector<size_t>(kernel_shape.begin(), kernel_shape.end())) << "_";
results << "OC=" << output_channels << "_";
results << "netPRC=" << netPrecision.name() << "_";
results << "ET=" << element_type << "_";
results << "targetDevice=" << targetName;
for (auto const& configItem : configuration) {
results << "_configItem=" << configItem.first << "_" << configItem.second;
results << "_configItem=" << configItem.first << "_" << configItem.second.as<std::string>();
}
return results.str();
}
void PermConvPermConcat::SetUp() {
InferenceEngine::Precision netPrecision;
std::array<size_t, 4> input_shape;
std::array<size_t, 2> kernel_shape;
ov::element::Type element_type;
ov::Shape input_shape;
ov::Shape kernel_shape;
size_t output_channels;
std::map<std::string, std::string> additional_config;
ov::AnyMap additional_config;
std::tie(netPrecision, targetDevice, input_shape, kernel_shape, output_channels, additional_config) = this->GetParam();
std::tie(element_type, targetDevice, input_shape, kernel_shape, output_channels, additional_config) =
this->GetParam();
configuration.insert(additional_config.begin(), additional_config.end());
const std::size_t input_dim = std::accumulate(input_shape.begin(), input_shape.end(), 1, std::multiplies<size_t>());
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
std::vector<size_t> input_dims { 1, input_dim };
std::vector<size_t> input_dims{1, input_dim};
std::vector<size_t> reshape_in_dims = std::vector<size_t>(input_shape.begin(), input_shape.end());
std::vector<size_t> permute_in_order = { 0, 3, 1, 2 };
std::vector<size_t> permute_out_order = { 0, 2, 3, 1 };
std::vector<size_t> permute_in_order = {0, 3, 1, 2};
std::vector<size_t> permute_out_order = {0, 2, 3, 1};
ov::ParameterVector input_parameter {std::make_shared<ov::op::v0::Parameter>(ngPrc, ov::Shape(input_dims))};
ov::ParameterVector input_parameter{std::make_shared<ov::op::v0::Parameter>(element_type, ov::Shape(input_dims))};
auto reshape_in_pattern = std::make_shared<ngraph::op::Constant>(ngraph::element::i64,
ngraph::Shape{4},
reshape_in_dims);
auto reshape_in = std::make_shared<ngraph::op::v1::Reshape>(input_parameter[0], reshape_in_pattern, false);
auto reshape_in_pattern = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{4}, reshape_in_dims);
auto reshape_in = std::make_shared<ov::op::v1::Reshape>(input_parameter[0], reshape_in_pattern, false);
auto permute_in_params = std::make_shared<ngraph::opset1::Constant>(ngraph::element::i64,
ngraph::Shape{4},
ngraph::Shape{permute_in_order});
auto permute_in = std::make_shared<ngraph::opset1::Transpose>(reshape_in, permute_in_params);
auto permute_in_params =
std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{4}, ov::Shape{permute_in_order});
auto permute_in = std::make_shared<ov::op::v1::Transpose>(reshape_in, permute_in_params);
auto conv_in_shape = permute_in->get_output_shape(0);
auto conv_weights_size = output_channels * (conv_in_shape[1]) * kernel_shape[0] * kernel_shape[1];
auto conv = ngraph::builder::makeConvolution(permute_in, ngPrc, {kernel_shape[0], kernel_shape[1]}, {1, 1}, {0, 0}, {0, 0}, {1, 1},
ngraph::op::PadType::VALID, output_channels, false, ov::test::utils::generate_float_numbers(conv_weights_size, -0.5f, 0.5f));
auto conv =
ngraph::builder::makeConvolution(permute_in,
element_type,
{kernel_shape[0], kernel_shape[1]},
{1, 1},
{0, 0},
{0, 0},
{1, 1},
ov::op::PadType::VALID,
output_channels,
false,
ov::test::utils::generate_float_numbers(conv_weights_size, -0.5f, 0.5f));
auto permute_out_params = std::make_shared<ngraph::opset1::Constant>(ngraph::element::i64,
ngraph::Shape{4},
permute_out_order);
auto permute_out = std::make_shared<ngraph::opset1::Transpose>(conv, permute_out_params);
auto permute_out_params = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{4}, permute_out_order);
auto permute_out = std::make_shared<ov::op::v1::Transpose>(conv, permute_out_params);
auto permute_out_shape = permute_out->get_output_shape(0);
auto concat_const = ngraph::builder::makeConstant(ngPrc, {1, 1, 1, permute_out_shape[3]},
ov::test::utils::generate_float_numbers(permute_out_shape[3], -10, 10));
auto concat_const =
ngraph::builder::makeConstant(element_type,
{1, 1, 1, permute_out_shape[3]},
ov::test::utils::generate_float_numbers(permute_out_shape[3], -10, 10));
auto concat = ngraph::builder::makeConcat({permute_out, concat_const}, 2);
auto reshape_out_pattern = std::make_shared<ngraph::opset1::Constant>(ngraph::element::i64,
ngraph::Shape{2},
auto reshape_out_pattern = std::make_shared<ov::op::v0::Constant>(
ov::element::i64,
ov::Shape{2},
InferenceEngine::SizeVector({1, (permute_out_shape[2] + 1) * permute_out_shape[3]}));
auto reshape_out = std::make_shared<ngraph::op::v1::Reshape>(concat, reshape_out_pattern, false);
auto reshape_out = std::make_shared<ov::op::v1::Reshape>(concat, reshape_out_pattern, false);
function = std::make_shared<ngraph::Function>(reshape_out, input_parameter, "perm_conv_perm_concat");
function = std::make_shared<ov::Model>(reshape_out, input_parameter, "perm_conv_perm_concat");
}
void PermConvPermConcat::Run() {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
LoadNetwork();
inferRequest = executableNetwork.CreateInferRequest();
inputs.clear();
for (const auto &input : cnnNetwork.getInputsInfo()) {
const auto &info = input.second;
auto tensorDesc = info->getTensorDesc();
auto blob = FuncTestUtils::createAndFillBlobFloat(tensorDesc, 2, -1, 100, 111);
FuncTestUtils::fillInputsBySinValues(blob);
inferRequest.SetBlob(info->name(), blob);
inputs.push_back(blob);
}
inferRequest.Infer();
Validate();
}
} // namespace SubgraphTestsDefinitions
} // namespace test
} // namespace ov