Skip to content

Commit 2fbbd7a

Browse files
authored
Added subgraph tests (opencv#100)
1 parent 141e218 commit 2fbbd7a

File tree

11 files changed

+368
-9
lines changed

11 files changed

+368
-9
lines changed

modules/arm_plugin/src/transformations/decompose_variadic_split.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,27 @@ ArmPlugin::pass::DecomposeVariadicSplit::DecomposeVariadicSplit() {
4242
ngraph::OutputVector slices;
4343
ngraph::NodeVector slice_nodes;
4444
std::string output_name = split->get_friendly_name();
45+
46+
int count_useless_outs = 0;
47+
for (auto out : split->outputs()) {
48+
auto inputs = out.get_target_inputs();
49+
if (inputs.empty()) {
50+
++count_useless_outs;
51+
}
52+
}
53+
4554
for (size_t i = 0; i < splits.size(); i++) {
4655
begin_vec[axis] = end_vec[axis];
4756
end_vec[axis] += splits[i];
4857

4958
auto begin = opset::Constant::create<int64_t>(ngraph::element::i64, ngraph::Shape{size}, begin_vec);
5059
auto end = opset::Constant::create<int64_t>(ngraph::element::i64, ngraph::Shape{size}, end_vec);
5160
auto slice = std::make_shared<opset::StridedSlice>(input, begin, end, stride, std::vector<int64_t>{}, std::vector<int64_t>{});
52-
slice->set_friendly_name(output_name + '.' + std::to_string(i));
61+
std::string name = output_name;
62+
if (splits.size() - count_useless_outs > 1) {
63+
name += '.' + std::to_string(i);
64+
}
65+
slice->set_friendly_name(name);
5366
slice_nodes.push_back(slice);
5467
slices.push_back(slice->output(0));
5568
}

modules/arm_plugin/tests/functional/shared_tests_instances/subgraph_tests/conv_eltwise_fusion.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const std::vector<ngraph::element::Type> types{
2525
{1, 1, 1, 1},
2626
};
2727

28-
INSTANTIATE_TEST_CASE_P(smoke_Convolution_2D, ConvEltwiseFusion,
28+
INSTANTIATE_TEST_CASE_P(smoke_Check_Convolution_2D, ConvEltwiseFusion,
2929
::testing::Combine(
3030
::testing::Values(ngraph::opset4::Convolution::type_info),
3131
::testing::ValuesIn(IN({MUL(4), ADD(5)})),
@@ -36,7 +36,7 @@ const std::vector<ngraph::element::Type> types{
3636
::testing::Values(CommonTestUtils::DEVICE_CPU)),
3737
ConvEltwiseFusion::getTestCaseName);
3838

39-
INSTANTIATE_TEST_CASE_P(smoke_Convolution_2D_4ops, ConvEltwiseFusion,
39+
INSTANTIATE_TEST_CASE_P(smoke_Check_Convolution_2D_4ops, ConvEltwiseFusion,
4040
::testing::Combine(
4141
::testing::Values(ngraph::opset4::Convolution::type_info),
4242
::testing::ValuesIn(IN({MUL(6), ADD(6)})),
@@ -47,7 +47,7 @@ const std::vector<ngraph::element::Type> types{
4747
::testing::Values(CommonTestUtils::DEVICE_CPU)),
4848
ConvEltwiseFusion::getTestCaseName);
4949

50-
INSTANTIATE_TEST_CASE_P(smoke_GroupConvolution_2D, ConvEltwiseFusion,
50+
INSTANTIATE_TEST_CASE_P(smoke_Check_GroupConvolution_2D, ConvEltwiseFusion,
5151
::testing::Combine(
5252
::testing::Values(ngraph::opset4::GroupConvolution::type_info),
5353
::testing::ValuesIn(IN({MUL(4), ADD(5)})),
@@ -58,7 +58,7 @@ const std::vector<ngraph::element::Type> types{
5858
::testing::Values(CommonTestUtils::DEVICE_CPU)),
5959
ConvEltwiseFusion::getTestCaseName);
6060

61-
INSTANTIATE_TEST_CASE_P(smoke_DepthwiseConvolution_2D, ConvEltwiseFusion,
61+
INSTANTIATE_TEST_CASE_P(smoke_Check_DepthwiseConvolution_2D, ConvEltwiseFusion,
6262
::testing::Combine(
6363
::testing::Values(ngraph::opset4::GroupConvolution::type_info),
6464
::testing::ValuesIn(IN({MUL(4), ADD(5)})),
@@ -80,7 +80,7 @@ const std::vector<ngraph::element::Type> types{
8080
{1, 3, 1}, // fused
8181
};
8282

83-
INSTANTIATE_TEST_CASE_P(smoke_Convolution_2D_Negative, ConvEltwiseFusion,
83+
INSTANTIATE_TEST_CASE_P(smoke_Check_Convolution_2D_Negative, ConvEltwiseFusion,
8484
::testing::Combine(
8585
::testing::Values(ngraph::opset4::Convolution::type_info),
8686
::testing::ValuesIn(IN({MUL(6), ADD(6)})),
@@ -96,7 +96,7 @@ const std::vector<ngraph::element::Type> types{
9696
{1, 3, 1, 1}, // fused
9797
};
9898

99-
INSTANTIATE_TEST_CASE_P(smoke_Convolution_2D_Negative_5ops, ConvEltwiseFusion,
99+
INSTANTIATE_TEST_CASE_P(smoke_Check_Convolution_2D_Negative_5ops, ConvEltwiseFusion,
100100
::testing::Combine(
101101
::testing::Values(ngraph::opset4::Convolution::type_info),
102102
::testing::ValuesIn(IN({ADD(5)})),
@@ -107,7 +107,7 @@ const std::vector<ngraph::element::Type> types{
107107
::testing::Values(CommonTestUtils::DEVICE_CPU)),
108108
ConvEltwiseFusion::getTestCaseName);
109109

110-
INSTANTIATE_TEST_CASE_P(smoke_GroupConvolution_2D_Negative, ConvEltwiseFusion,
110+
INSTANTIATE_TEST_CASE_P(smoke_Check_GroupConvolution_2D_Negative, ConvEltwiseFusion,
111111
::testing::Combine(
112112
::testing::Values(ngraph::opset4::GroupConvolution::type_info),
113113
::testing::ValuesIn(IN({MUL(6), ADD(6)})),
@@ -118,7 +118,7 @@ const std::vector<ngraph::element::Type> types{
118118
::testing::Values(CommonTestUtils::DEVICE_CPU)),
119119
ConvEltwiseFusion::getTestCaseName);
120120

121-
INSTANTIATE_TEST_CASE_P(smoke_DepthwiseConvolution_2D_Negative, ConvEltwiseFusion,
121+
INSTANTIATE_TEST_CASE_P(smoke_Check_DepthwiseConvolution_2D_Negative, ConvEltwiseFusion,
122122
::testing::Combine(
123123
::testing::Values(ngraph::opset4::GroupConvolution::type_info),
124124
::testing::ValuesIn(IN({MUL(6), ADD(6)})),
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (C) 2020 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
#include <subgraph_tests/get_output_before_activation.hpp>
4+
#include "common_test_utils/test_constants.hpp"
5+
6+
namespace SubgraphTestsDefinitions {
7+
namespace {
8+
std::vector<size_t> input_sizes = {
9+
80,
10+
32,
11+
64,
12+
100
13+
};
14+
15+
std::vector<midOutputType> midLayerTypes {
16+
midOutputType::Mul,
17+
midOutputType::Sub,
18+
midOutputType::Sum
19+
};
20+
21+
std::map<std::string, std::string> additional_config = {};
22+
} // namespace
23+
24+
const std::vector<InferenceEngine::Precision> netPrecisions = {
25+
InferenceEngine::Precision::FP32,
26+
InferenceEngine::Precision::FP16
27+
};
28+
29+
30+
INSTANTIATE_TEST_CASE_P(smoke_Check, OutputBeforeActivation,
31+
::testing::Combine(
32+
::testing::Values(CommonTestUtils::DEVICE_CPU),
33+
::testing::ValuesIn(netPrecisions),
34+
::testing::ValuesIn(input_sizes),
35+
::testing::ValuesIn(midLayerTypes),
36+
::testing::Values(additional_config)),
37+
OutputBeforeActivation::getTestCaseName);
38+
} // namespace SubgraphTestsDefinitions
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright (C) 2020 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
5+
#include <vector>
6+
7+
#include "common_test_utils/test_constants.hpp"
8+
#include "subgraph_tests/matmul_squeeze_add.hpp"
9+
10+
using namespace SubgraphTestsDefinitions;
11+
12+
namespace {
13+
const std::vector<InferenceEngine::Precision> netPrecisions = {
14+
InferenceEngine::Precision::FP32,
15+
InferenceEngine::Precision::FP16
16+
};
17+
18+
const std::vector<std::map<std::string, std::string>> configs = {
19+
{ }
20+
};
21+
22+
std::vector<std::vector<size_t>> input_shapes = {
23+
{1, 8},
24+
{1, 42},
25+
{1, 100},
26+
{1, 128},
27+
{1, 512}
28+
};
29+
30+
std::vector<size_t> output_sizes = {
31+
1000,
32+
512,
33+
128,
34+
42,
35+
16,
36+
8
37+
};
38+
39+
INSTANTIATE_TEST_CASE_P(smoke_Check, MatmulSqueezeAddTest,
40+
::testing::Combine(
41+
::testing::ValuesIn(netPrecisions),
42+
::testing::Values(CommonTestUtils::DEVICE_CPU),
43+
::testing::ValuesIn(configs),
44+
::testing::ValuesIn(input_shapes),
45+
::testing::ValuesIn(output_sizes)),
46+
MatmulSqueezeAddTest::getTestCaseName);
47+
} // namespace
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (C) 2020 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
5+
#include <vector>
6+
7+
#include "subgraph_tests/multiply_add.hpp"
8+
9+
using namespace SubgraphTestsDefinitions;
10+
11+
namespace {
12+
13+
const std::vector<InferenceEngine::Precision> netPrecisions = {
14+
InferenceEngine::Precision::FP32,
15+
InferenceEngine::Precision::FP16
16+
};
17+
18+
const std::vector<std::vector<size_t>> inputShapes = {
19+
{2, 3},
20+
{2, 3, 4},
21+
{1, 3, 2, 2},
22+
{1, 3, 2, 2, 6},
23+
};
24+
25+
INSTANTIATE_TEST_CASE_P(smoke_Check, MultiplyAddLayerTest,
26+
::testing::Combine(
27+
::testing::ValuesIn(inputShapes),
28+
::testing::ValuesIn(netPrecisions),
29+
::testing::Values(CommonTestUtils::DEVICE_CPU)),
30+
MultiplyAddLayerTest::getTestCaseName);
31+
32+
} // namespace
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright (C) 2020 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
#include <vector>
4+
#include "subgraph_tests/perm_conv_perm_concat.hpp"
5+
#include "common_test_utils/test_constants.hpp"
6+
namespace {
7+
std::vector<std::array<size_t, 4>> input_shapes {
8+
{1, 1, 7, 32},
9+
{1, 1, 8, 16},
10+
};
11+
12+
std::vector<std::array<size_t, 2>> kernel_shapes {
13+
{1, 3},
14+
{1, 5},
15+
};
16+
17+
std::vector<size_t> output_channels {
18+
32,
19+
64,
20+
};
21+
22+
std::vector<InferenceEngine::Precision> netPrecisions = {
23+
InferenceEngine::Precision::FP32,
24+
InferenceEngine::Precision::FP16,
25+
};
26+
27+
std::map<std::string, std::string> additional_config = {};
28+
} // namespace
29+
30+
namespace SubgraphTestsDefinitions {
31+
INSTANTIATE_TEST_CASE_P(smoke_Check, PermConvPermConcat,
32+
::testing::Combine(
33+
::testing::ValuesIn(netPrecisions),
34+
::testing::Values(CommonTestUtils::DEVICE_CPU),
35+
::testing::ValuesIn(input_shapes),
36+
::testing::ValuesIn(kernel_shapes),
37+
::testing::ValuesIn(output_channels),
38+
::testing::Values(additional_config)),
39+
PermConvPermConcat::getTestCaseName);
40+
} // namespace SubgraphTestsDefinitions
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (C) 2019 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
5+
#include <vector>
6+
7+
#include "subgraph_tests/relu_shape_of.hpp"
8+
#include "common_test_utils/test_constants.hpp"
9+
10+
using namespace SubgraphTestsDefinitions;
11+
12+
namespace {
13+
const std::vector<InferenceEngine::Precision> netPrecisions = {
14+
InferenceEngine::Precision::I32
15+
};
16+
17+
INSTANTIATE_TEST_CASE_P(smoke_Check, ReluShapeOfSubgraphTest,
18+
::testing::Combine(
19+
::testing::ValuesIn(netPrecisions),
20+
::testing::Values(std::vector<size_t>({20, 10, 10, 10})),
21+
::testing::Values(CommonTestUtils::DEVICE_CPU)),
22+
ReluShapeOfSubgraphTest::getTestCaseName);
23+
} // namespace
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright (C) 2020 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
#include <vector>
4+
#include "subgraph_tests/reshape_squeeze_reshape_relu.hpp"
5+
#include "common_test_utils/test_constants.hpp"
6+
7+
using namespace SubgraphTestsDefinitions;
8+
9+
namespace {
10+
std::vector<ShapeAxesTuple> inputs{
11+
{{1, 1, 3}, {0, 1}},
12+
{{1, 1, 3}, {0}},
13+
{{1, 1, 3}, {1}},
14+
{{1, 3, 1}, {0, 2}},
15+
{{1, 3, 1}, {0}},
16+
{{1, 3, 1}, {2}},
17+
{{3, 1, 1}, {1, 2}},
18+
{{3, 1, 1}, {1}},
19+
{{3, 1, 1}, {2}},
20+
{{4, 1, 3, 1}, {1, 3}},
21+
{{4, 1, 1, 3}, {1, 2}},
22+
{{1, 4, 1, 3}, {0, 2}},
23+
{{1, 3, 5, 2, 1}, {0, 4}},
24+
{{3, 1, 2, 4, 4, 3}, {1}},
25+
{{1, 1, 1, 1, 1, 3}, {0, 1, 2, 3, 4}},
26+
{{1, 1, 1, 1, 1, 3}, {1, 3}},
27+
{{1}, {0}},
28+
};
29+
30+
std::vector<InferenceEngine::Precision> netPrecisions = {InferenceEngine::Precision::FP32,
31+
InferenceEngine::Precision::FP16,
32+
};
33+
34+
const std::vector<ngraph::helpers::SqueezeOpType> opTypes = {
35+
ngraph::helpers::SqueezeOpType::SQUEEZE,
36+
ngraph::helpers::SqueezeOpType::UNSQUEEZE
37+
};
38+
39+
INSTANTIATE_TEST_CASE_P(smoke_Check, ReshapeSqueezeReshapeRelu,
40+
::testing::Combine(
41+
::testing::ValuesIn(inputs),
42+
::testing::ValuesIn(netPrecisions),
43+
::testing::Values(CommonTestUtils::DEVICE_CPU),
44+
::testing::ValuesIn(opTypes)),
45+
ReshapeSqueezeReshapeRelu::getTestCaseName);
46+
} // namespace
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (C) 2019 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
5+
#include <vector>
6+
7+
#include "subgraph_tests/split_conv_concat.hpp"
8+
#include "common_test_utils/test_constants.hpp"
9+
10+
using namespace SubgraphTestsDefinitions;
11+
12+
namespace {
13+
14+
const std::vector<InferenceEngine::Precision> netPrecisions = {
15+
InferenceEngine::Precision::FP32,
16+
InferenceEngine::Precision::FP16
17+
};
18+
19+
INSTANTIATE_TEST_CASE_P(smoke_Check, SplitConvConcat,
20+
::testing::Combine(
21+
::testing::ValuesIn(netPrecisions),
22+
::testing::Values(InferenceEngine::SizeVector({1, 6, 40, 40})),
23+
::testing::Values(CommonTestUtils::DEVICE_CPU)),
24+
SplitConvConcat::getTestCaseName);
25+
} // namespace
26+
27+
28+
29+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (C) 2021 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
//
4+
5+
#include <vector>
6+
7+
#include "subgraph_tests/tensor_names.hpp"
8+
#include "common_test_utils/test_constants.hpp"
9+
10+
using namespace SubgraphTestsDefinitions;
11+
12+
namespace {
13+
INSTANTIATE_TEST_CASE_P(smoke_Check, TensorNamesTest,
14+
::testing::Values(CommonTestUtils::DEVICE_CPU),
15+
TensorNamesTest::getTestCaseName);
16+
} // namespace

0 commit comments

Comments
 (0)