Skip to content

Commit

Permalink
Template plugin folder to API2.0 (openvinotoolkit#20862)
Browse files Browse the repository at this point in the history
* Remove unused IE namespace from template plugin

* Remove unused `ngraph::HostTensor`

* Template `ConvolutionLayerTest` to API2.0

* Template `ReshapeLayerTest` to API2.0

* Template `SplitLayerTest` to API2.0

* Remove extra `InferenceEngine::PluginConfigParams`

* CLangFormat
  • Loading branch information
vurusovs authored Nov 4, 2023
1 parent fda1fd9 commit 47cdbb9
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 110 deletions.
7 changes: 3 additions & 4 deletions src/plugins/template/backend/ops/convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ inline void evaluate(const std::shared_ptr<ov::op::v1::ConvertLike>& op,
outputs[0].set_shape(inputs[0].get_shape());
size_t element_count = ov::shape_size(outputs[0].get_shape());

if (((ti == ngraph::element::u1) || (to == ngraph::element::u1)) ||
((ti == ngraph::element::u4) || (to == ngraph::element::u4)) ||
((ti == ngraph::element::i4) || (to == ngraph::element::i4)) ||
((ti == ngraph::element::nf4) || (to == ngraph::element::nf4))) {
if (((ti == ov::element::u1) || (to == ov::element::u1)) || ((ti == ov::element::u4) || (to == ov::element::u4)) ||
((ti == ov::element::i4) || (to == ov::element::i4)) ||
((ti == ov::element::nf4) || (to == ov::element::nf4))) {
ov::reference::detail::lp_convert(inputs[0].data<T_I>(), outputs[0].data<T_O>(), element_count, ti, to);
} else {
ov::reference::convert(inputs[0].data<T_I>(), outputs[0].data<T_O>(), element_count);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "openvino/op/i420_to_rgb.hpp"

using namespace ov;
using namespace InferenceEngine;
using namespace reference_tests;

class ReferenceConvertColorI420LayerTest : public testing::Test, public CommonReferenceTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "openvino/op/nv12_to_rgb.hpp"

using namespace ov;
using namespace InferenceEngine;
using namespace reference_tests;

class ReferenceConvertColorNV12LayerTest : public testing::Test, public CommonReferenceTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

using namespace reference_tests;
using namespace ov;
using namespace InferenceEngine;

struct EmbeddingSegmentsSumParams {
template <class IT>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

using namespace reference_tests;
using namespace ov;
using namespace InferenceEngine;

struct EmbeddingBagOffsetsSumParams {
template <class IT>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

using namespace reference_tests;
using namespace ov;
using namespace InferenceEngine;

struct EmbeddingBagPackedSumParams {
template <class IT>
Expand Down
1 change: 0 additions & 1 deletion src/plugins/template/tests/functional/op_reference/exp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

using namespace reference_tests;
using namespace ov;
using namespace InferenceEngine;

namespace {
struct ExpParams {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

using namespace reference_tests;
using namespace ov;
using namespace InferenceEngine;

namespace {
struct GeluParams {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

using namespace reference_tests;
using namespace ov;
using namespace InferenceEngine;

namespace {
struct HSwishParams {
Expand Down
1 change: 0 additions & 1 deletion src/plugins/template/tests/functional/op_reference/if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

using namespace reference_tests;
using namespace ov;
using namespace InferenceEngine;

struct IfFunctionalBase {
virtual std::shared_ptr<Model> create_function(const std::vector<reference_tests::Tensor>& if_inputs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

using namespace reference_tests;
using namespace ov;
using namespace InferenceEngine;

namespace {
struct LogSoftmaxParams {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

using namespace ov::test::behavior;

using namespace InferenceEngine::PluginConfigParams;

namespace {

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "single_layer_tests/convolution.hpp"
#include "single_op_tests/convolution.hpp"

#include <vector>

#include "common_test_utils/test_constants.hpp"

using namespace LayerTestsDefinitions;
using ov::test::ConvolutionLayerTest;

namespace {

// ! [test_convolution:declare_parameters]
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
InferenceEngine::Precision::FP16,
const std::vector<ov::element::Type> model_types = {
ov::element::f32,
ov::element::f16,
};

/* ============= 2D Convolution ============= */
Expand Down Expand Up @@ -46,30 +46,24 @@ const auto conv2DParams_AutoPadValid = ::testing::Combine(::testing::ValuesIn(ke
::testing::Values(ov::op::PadType::VALID));

// ! [test_convolution:instantiate]
INSTANTIATE_TEST_SUITE_P(Convolution2D_ExplicitPadding,
ConvolutionLayerTest,
::testing::Combine(conv2DParams_ExplicitPadding,
::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(std::vector<size_t>({1, 3, 30, 30})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
ConvolutionLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(
Convolution2D_ExplicitPadding,
ConvolutionLayerTest,
::testing::Combine(conv2DParams_ExplicitPadding,
::testing::ValuesIn(model_types),
::testing::Values(ov::test::static_shapes_to_test_representation({{1, 3, 30, 30}})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
ConvolutionLayerTest::getTestCaseName);
// ! [test_convolution:instantiate]

INSTANTIATE_TEST_SUITE_P(Convolution2D_AutoPadValid,
ConvolutionLayerTest,
::testing::Combine(conv2DParams_AutoPadValid,
::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(std::vector<size_t>({1, 3, 30, 30})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
ConvolutionLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(
Convolution2D_AutoPadValid,
ConvolutionLayerTest,
::testing::Combine(conv2DParams_AutoPadValid,
::testing::ValuesIn(model_types),
::testing::Values(ov::test::static_shapes_to_test_representation({{1, 3, 30, 30}})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
ConvolutionLayerTest::getTestCaseName);

/* ============= 3D Convolution ============= */

Expand All @@ -95,28 +89,22 @@ const auto conv3DParams_AutoPadValid = ::testing::Combine(::testing::ValuesIn(ke
::testing::Values(5),
::testing::Values(ov::op::PadType::VALID));

INSTANTIATE_TEST_SUITE_P(smoke_Convolution3D_ExplicitPadding,
ConvolutionLayerTest,
::testing::Combine(conv3DParams_ExplicitPadding,
::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(std::vector<size_t>({1, 3, 10, 10, 10})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
ConvolutionLayerTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(nightly_Convolution3D_AutoPadValid,
ConvolutionLayerTest,
::testing::Combine(conv3DParams_AutoPadValid,
::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(std::vector<size_t>({1, 3, 10, 10, 10})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
ConvolutionLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(
smoke_Convolution3D_ExplicitPadding,
ConvolutionLayerTest,
::testing::Combine(conv3DParams_ExplicitPadding,
::testing::ValuesIn(model_types),
::testing::Values(ov::test::static_shapes_to_test_representation({{1, 3, 10, 10, 10}})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
ConvolutionLayerTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(
nightly_Convolution3D_AutoPadValid,
ConvolutionLayerTest,
::testing::Combine(conv3DParams_AutoPadValid,
::testing::ValuesIn(model_types),
::testing::Values(ov::test::static_shapes_to_test_representation({{1, 3, 10, 10, 10}})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
ConvolutionLayerTest::getTestCaseName);

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,43 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "single_layer_tests/reshape.hpp"
#include "single_op_tests/reshape.hpp"

#include <vector>

#include "common_test_utils/test_constants.hpp"

using namespace LayerTestsDefinitions;
using ov::test::ReshapeLayerTest;

namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32,
const std::vector<ov::element::Type> model_types = {
ov::element::f32,
};

INSTANTIATE_TEST_SUITE_P(smoke_ReshapeCheckDynBatch,
ReshapeLayerTest,
::testing::Combine(::testing::Values(true),
::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::ValuesIn(model_types),
::testing::Values(std::vector<size_t>({30, 30, 30, 30})),
::testing::Values(std::vector<int64_t>({30, 30, 30, 30})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE),
::testing::Values(std::map<std::string, std::string>({}))),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
ReshapeLayerTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(smoke_ReshapeCheck,
ReshapeLayerTest,
::testing::Combine(::testing::Values(true),
::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::ValuesIn(model_types),
::testing::Values(std::vector<size_t>({10, 10, 10, 10})),
::testing::Values(std::vector<int64_t>({10, 0, 100})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE),
::testing::Values(std::map<std::string, std::string>({}))),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
ReshapeLayerTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(smoke_ReshapeCheckNegative,
ReshapeLayerTest,
::testing::Combine(::testing::Values(true),
::testing::ValuesIn(netPrecisions),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::ValuesIn(model_types),
::testing::Values(std::vector<size_t>({10, 10, 10, 10})),
::testing::Values(std::vector<int64_t>({10, -1, 100})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE),
::testing::Values(std::map<std::string, std::string>({}))),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
ReshapeLayerTest::getTestCaseName);
} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,25 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "single_layer_tests/split.hpp"
#include "single_op_tests/split.hpp"

#include <vector>

#include "common_test_utils/test_constants.hpp"

using namespace LayerTestsDefinitions;
using ov::test::SplitLayerTest;

namespace {

INSTANTIATE_TEST_SUITE_P(smoke_NumSplitsCheck,
SplitLayerTest,
::testing::Combine(::testing::Values(1, 2, 3, 5, 6, 10, 30),
::testing::Values(0, 1, 2, 3),
::testing::Values(InferenceEngine::Precision::FP32),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(InferenceEngine::Layout::ANY),
::testing::Values(std::vector<size_t>({30, 30, 30, 30})),
::testing::Values(std::vector<size_t>({})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
SplitLayerTest::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(
smoke_NumSplitsCheck,
SplitLayerTest,
::testing::Combine(::testing::Values(1, 2, 3, 5, 6, 10, 30),
::testing::Values(0, 1, 2, 3),
::testing::Values(ov::element::f32),
::testing::Values(ov::test::static_shapes_to_test_representation({{30, 30, 30, 30}})),
::testing::Values(std::vector<size_t>({})),
::testing::Values(ov::test::utils::DEVICE_TEMPLATE)),
SplitLayerTest::getTestCaseName);

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ static RefPreprocessParams resize_to_network_width_height() {
return f;
};

auto result = std::make_shared<ngraph::HostTensor>();
// clang-format off
std::vector<float> input = {0., 1., 2., 3., 4.,
1., 2., 3., 4., 5.,
Expand Down Expand Up @@ -380,7 +379,6 @@ static RefPreprocessParams resize_to_specified_width_height() {
return f;
};

auto result = std::make_shared<ngraph::HostTensor>();
// clang-format off
std::vector<float> input = {0., 1., 2., 3., 4.,
1., 2., 3., 4., 5.,
Expand Down Expand Up @@ -747,7 +745,6 @@ static RefPreprocessParams resize_and_convert_layout() {
return f;
};

auto result = std::make_shared<ngraph::HostTensor>();
// clang-format off
std::vector<float> input = {
1., 1., 1., 1., // channel 1
Expand Down Expand Up @@ -857,7 +854,6 @@ static RefPreprocessParams convert_color_nv12_layout_resize() {
return f;
};

auto result = std::make_shared<ngraph::HostTensor>();
// clang-format off
auto input = std::vector<uint8_t> {81, 81, 145, 145, // RRGG
81, 81, 145, 145, // RRGG
Expand Down

0 comments on commit 47cdbb9

Please sign in to comment.