Skip to content

Commit 7474440

Browse files
committed
move test from cpu plugin to shared
1 parent 9c40449 commit 7474440

File tree

7 files changed

+37
-34
lines changed

7 files changed

+37
-34
lines changed

src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/conversion.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -282,20 +282,6 @@ void ConvertToBooleanCPULayerTest::generate_inputs(const std::vector<ov::Shape>&
282282
inputs.insert({funcInputs[0].get_node_shared_ptr(), tensor});
283283
}
284284

285-
void ConvertI32ToU8CPULayerTest::validate_out_prc() const {
286-
if (inPrc != ov::element::i32 || outPrc != ov::element::u8)
287-
FAIL() << "ConvertI32ToU8CPULayerTest supports only i32->u8 conversion.";
288-
}
289-
290-
void ConvertI32ToU8CPULayerTest::generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) {
291-
inputs.clear();
292-
const auto& funcInputs = function->inputs();
293-
const auto& funcInput = funcInputs[0];
294-
ov::Tensor tensor(funcInput.get_element_type(), targetInputStaticShapes[0]);
295-
ov::test::utils::fill_data_random(tensor.data<int32_t>(), tensor.get_size(), 1024, -512);
296-
inputs.insert({funcInput.get_node_shared_ptr(), tensor});
297-
}
298-
299285
TEST_P(ConvertCPULayerTest, CompareWithRefs) {
300286
run();
301287
CheckPluginRelatedResults(compiledModel, std::set<std::string>{"Convert", "Subgraph"});
@@ -309,11 +295,6 @@ TEST_P(ConvertToBooleanCPULayerTest, CompareWithRefs) {
309295
CheckPluginRelatedResults(compiledModel, std::set<std::string>{});
310296
}
311297

312-
TEST_P(ConvertI32ToU8CPULayerTest, CompareWithRefs) {
313-
run();
314-
CheckPluginRelatedResults(compiledModel, std::set<std::string>{"Convert", "Subgraph"});
315-
}
316-
317298
namespace Conversion {
318299

319300
const std::vector<InputShape>& inShapes_4D_static() {

src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/classes/conversion.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ class ConvertToBooleanCPULayerTest : public ConvertCPULayerTest {
4343
void validate_out_prc() const override;
4444
};
4545

46-
class ConvertI32ToU8CPULayerTest : public ConvertCPULayerTest {
47-
protected:
48-
void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override;
49-
void validate_out_prc() const override;
50-
};
51-
5246
namespace Conversion {
5347
const std::vector<InputShape>& inShapes_4D_static();
5448
const std::vector<InputShape>& inShapes_4D_dynamic();

src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/instances/x64/conversion.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_ConvertCPULayerTest_BOOL_Dynamic, ConvertToBoolea
6767
::testing::Values(CPUSpecificParams({nchw}, {nchw}, {}, {}))),
6868
ConvertToBooleanCPULayerTest::getTestCaseName);
6969

70-
INSTANTIATE_TEST_SUITE_P(smoke_ConvertCPULayerTest_I32ToU8_Static, ConvertI32ToU8CPULayerTest,
71-
::testing::Combine(
72-
::testing::ValuesIn(inShapes_4D_static()),
73-
::testing::Values(ov::element::i32),
74-
::testing::Values(ov::element::u8),
75-
::testing::Values(ov::test::SpecialValue::none),
76-
::testing::Values(CPUSpecificParams({nchw}, {nchw}, {}, {}))),
77-
ConvertI32ToU8CPULayerTest::getTestCaseName);
78-
7970
} // namespace
8071
} // namespace Conversion
8172
} // namespace test

src/plugins/intel_cpu/tests/functional/shared_tests_instances/single_layer_tests/conversion.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace {
1111
using ov::test::ConversionLayerTest;
12+
using ov::test::ConversionSpecifyInputLayerTest;
1213

1314
const std::vector<ov::test::utils::ConversionTypes> conversionOpTypes = {
1415
ov::test::utils::ConversionTypes::CONVERT,
@@ -79,4 +80,13 @@ INSTANTIATE_TEST_SUITE_P(smoke_ConversionFromF8LayerTest,
7980
::testing::Values(ov::test::utils::DEVICE_CPU)),
8081
ConversionLayerTest::getTestCaseName);
8182

83+
INSTANTIATE_TEST_SUITE_P(smoke_ConversionI32ToU8LayerTest,
84+
ConversionSpecifyInputLayerTest,
85+
::testing::Combine(::testing::Values(conversionOpTypes[0]),
86+
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(shapes)),
87+
::testing::Values(ov::element::i32),
88+
::testing::Values(ov::element::u8),
89+
::testing::Values(ov::test::utils::DEVICE_CPU)),
90+
ConversionSpecifyInputLayerTest::getTestCaseName);
91+
8292
} // namespace

src/tests/functional/plugin/shared/include/shared_test_classes/single_op/conversion.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,11 @@ class ConversionLayerTest : public testing::WithParamInterface<ConversionParamsT
2626
protected:
2727
void SetUp() override;
2828
};
29+
30+
class ConversionSpecifyInputLayerTest : public ConversionLayerTest {
31+
protected:
32+
void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override;
33+
};
34+
2935
} // namespace test
3036
} // namespace ov

src/tests/functional/plugin/shared/include/single_op_tests/conversion.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ namespace test {
1111
TEST_P(ConversionLayerTest, Inference) {
1212
run();
1313
};
14+
TEST_P(ConversionSpecifyInputLayerTest, Inference) {
15+
run();
16+
};
1417
} // namespace test
1518
} // namespace ov

src/tests/functional/plugin/shared/src/single_op/conversion.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
//
44

55
#include "shared_test_classes/single_op/conversion.hpp"
6+
7+
#include "common_test_utils/data_utils.hpp"
68
#include "openvino/op/convert.hpp"
79
#include "openvino/op/convert_like.hpp"
810

@@ -57,5 +59,21 @@ void ConversionLayerTest::SetUp() {
5759
auto result = std::make_shared<ov::op::v0::Result>(conversion);
5860
function = std::make_shared<ov::Model>(result, params, "Conversion");
5961
}
62+
63+
void ConversionSpecifyInputLayerTest::generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) {
64+
const auto& [conversion_type, shapes, input_type, convert_type, _targetDevice] = GetParam();
65+
if (input_type != ov::element::i32 || convert_type != ov::element::u8) {
66+
SubgraphBaseTest::generate_inputs(targetInputStaticShapes);
67+
return;
68+
}
69+
70+
inputs.clear();
71+
const auto& funcInputs = function->inputs();
72+
const auto& funcInput = funcInputs[0];
73+
ov::Tensor tensor(funcInput.get_element_type(), targetInputStaticShapes[0]);
74+
ov::test::utils::fill_data_random(tensor.data<int32_t>(), tensor.get_size(), 1024, -512);
75+
inputs.insert({funcInput.get_node_shared_ptr(), tensor});
76+
}
77+
6078
} // namespace test
6179
} // namespace ov

0 commit comments

Comments
 (0)