Refactor NonZeroLayerTest, NormalizeL2LayerTest, OneHotLayerTest, PadLayerTest (#20318)
* Refactor NonZeroLayerTest * Refactor NormalizeL2LayerTest * Refactor OneHotLayerTest * Refactor PadLayerTest * Apply comments
This commit is contained in:
parent
74690d038b
commit
fa33693c4a
@ -2,35 +2,34 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "single_layer_tests/nonzero.hpp"
|
||||
#include "single_op_tests/nonzero.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
#include <vector>
|
||||
|
||||
using namespace ngraph::helpers;
|
||||
using namespace LayerTestsDefinitions;
|
||||
|
||||
namespace {
|
||||
std::vector<std::vector<size_t>> inShapes = {
|
||||
{1000},
|
||||
{4, 1000},
|
||||
{2, 4, 1000},
|
||||
{2, 4, 4, 1000},
|
||||
{2, 4, 4, 2, 1000},
|
||||
};
|
||||
using ov::test::NonZeroLayerTest;
|
||||
|
||||
const std::vector<InferenceEngine::Precision> inputPrecisions = {
|
||||
InferenceEngine::Precision::I32,
|
||||
InferenceEngine::Precision::FP16,
|
||||
InferenceEngine::Precision::U8,
|
||||
};
|
||||
std::vector<std::vector<ov::Shape>> input_shapes_static = {
|
||||
{{1000}},
|
||||
{{4, 1000}},
|
||||
{{2, 4, 1000}},
|
||||
{{2, 4, 4, 1000}},
|
||||
{{2, 4, 4, 2, 1000}},
|
||||
};
|
||||
|
||||
ConfigMap config;
|
||||
const std::vector<ov::element::Type> model_types = {
|
||||
ov::element::i32,
|
||||
ov::element::f16,
|
||||
ov::element::u8,
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_nonzero, NonZeroLayerTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inShapes),
|
||||
::testing::ValuesIn(inputPrecisions),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU),
|
||||
::testing::Values(config)),
|
||||
NonZeroLayerTest::getTestCaseName);
|
||||
std::map<std::string, std::string> config = {};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_nonzero, NonZeroLayerTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
|
||||
::testing::ValuesIn(model_types),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU),
|
||||
::testing::Values(config)),
|
||||
NonZeroLayerTest::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -4,36 +4,38 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "single_layer_tests/normalize_l2.hpp"
|
||||
|
||||
using namespace LayerTestsDefinitions;
|
||||
#include "single_op_tests/normalize_l2.hpp"
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::FP16
|
||||
using ov::test::NormalizeL2LayerTest;
|
||||
|
||||
const std::vector<ov::element::Type> model_types = {
|
||||
ov::element::f32,
|
||||
ov::element::f16
|
||||
};
|
||||
|
||||
const std::vector<float> eps = {1e-12f, 1e-6f, 1e-3f, 0.1f, 100};
|
||||
|
||||
const std::vector<ngraph::op::EpsMode> epsMode = {
|
||||
ngraph::op::EpsMode::ADD,
|
||||
ngraph::op::EpsMode::MAX,
|
||||
const std::vector<ov::op::EpsMode> eps_modes = {
|
||||
ov::op::EpsMode::ADD,
|
||||
ov::op::EpsMode::MAX,
|
||||
};
|
||||
|
||||
/* ============= 1D ============= */
|
||||
// [SKIPPED][CPU] Unsupported rank, Issue: 35627
|
||||
const std::vector<std::vector<int64_t>> axes_1D = {
|
||||
const std::vector<std::vector<int64_t>> axes_1d = {
|
||||
{},
|
||||
{0}
|
||||
};
|
||||
|
||||
std::vector<ov::Shape> input_shape_1d_static = {{5}};
|
||||
|
||||
const auto normL2params_1D = testing::Combine(
|
||||
testing::ValuesIn(axes_1D),
|
||||
testing::ValuesIn(axes_1d),
|
||||
testing::ValuesIn(eps),
|
||||
testing::ValuesIn(epsMode),
|
||||
testing::ValuesIn(std::vector<std::vector<size_t>>({{5}})),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::ValuesIn(eps_modes),
|
||||
testing::Values(ov::test::static_shapes_to_test_representation(input_shape_1d_static)),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
@ -54,12 +56,14 @@ const std::vector<std::vector<int64_t>> axes_2D = {
|
||||
// {0, 1},
|
||||
};
|
||||
|
||||
std::vector<ov::Shape> input_shape_2d_static = {{5, 3}};
|
||||
|
||||
const auto normL2params_2D = testing::Combine(
|
||||
testing::ValuesIn(axes_2D),
|
||||
testing::ValuesIn(eps),
|
||||
testing::ValuesIn(epsMode),
|
||||
testing::ValuesIn(std::vector<std::vector<size_t>>({{5, 3}})),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::ValuesIn(eps_modes),
|
||||
testing::Values(ov::test::static_shapes_to_test_representation(input_shape_2d_static)),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
@ -84,12 +88,14 @@ const std::vector<std::vector<int64_t>> axes_3D = {
|
||||
// {0, 1, 2}
|
||||
};
|
||||
|
||||
std::vector<ov::Shape> input_shape_3d_static = {{2, 5, 3}};
|
||||
|
||||
const auto normL2params_3D = testing::Combine(
|
||||
testing::ValuesIn(axes_3D),
|
||||
testing::ValuesIn(eps),
|
||||
testing::ValuesIn(epsMode),
|
||||
testing::ValuesIn(std::vector<std::vector<size_t>>({{2, 5, 3}})),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::ValuesIn(eps_modes),
|
||||
testing::Values(ov::test::static_shapes_to_test_representation(input_shape_3d_static)),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
@ -117,12 +123,14 @@ const std::vector<std::vector<int64_t>> axes_4D = {
|
||||
// {0, 1, 2, 3}
|
||||
};
|
||||
|
||||
std::vector<ov::Shape> input_shape_4d_static = {{2, 3, 10, 5}};
|
||||
|
||||
const auto normL2params_4D = testing::Combine(
|
||||
testing::ValuesIn(axes_4D),
|
||||
testing::ValuesIn(eps),
|
||||
testing::ValuesIn(epsMode),
|
||||
testing::ValuesIn(std::vector<std::vector<size_t>>({{2, 3, 10, 5}})),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::ValuesIn(eps_modes),
|
||||
testing::Values(ov::test::static_shapes_to_test_representation(input_shape_4d_static)),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
@ -153,12 +161,14 @@ const std::vector<std::vector<int64_t>> axes_5D = {
|
||||
{0, 1, 2, 3}
|
||||
};
|
||||
|
||||
std::vector<ov::Shape> input_shape_5d_static = {{2, 2, 3, 10, 5}};
|
||||
|
||||
const auto normL2params_5D = testing::Combine(
|
||||
testing::ValuesIn(axes_5D),
|
||||
testing::ValuesIn(eps),
|
||||
testing::ValuesIn(epsMode),
|
||||
testing::ValuesIn(std::vector<std::vector<size_t>>({{2, 2, 3, 10, 5}})),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::ValuesIn(eps_modes),
|
||||
testing::Values(ov::test::static_shapes_to_test_representation(input_shape_5d_static)),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
|
@ -3,96 +3,97 @@
|
||||
//
|
||||
|
||||
#include <vector>
|
||||
#include "single_layer_tests/one_hot.hpp"
|
||||
|
||||
using namespace LayerTestsDefinitions;
|
||||
#include "single_op_tests/one_hot.hpp"
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::I32,
|
||||
using ov::test::OneHotLayerTest;
|
||||
|
||||
const std::vector<ov::element::Type> model_types = {
|
||||
ov::element::i32,
|
||||
};
|
||||
|
||||
const std::vector<ngraph::element::Type> argDepthType_IC = { ngraph::element::i32 };
|
||||
const std::vector<int64_t> argDepth_IC = { 1, 5, 1017 };
|
||||
const std::vector<ngraph::element::Type> argSetType_IC = { ngraph::element::i32 };
|
||||
const std::vector<float> argOnValue_IC = { 0, 1, -29 };
|
||||
const std::vector<float> argOffValue_IC = { 0, 1, -127 };
|
||||
const std::vector<int64_t> argAxis_IC = {0};
|
||||
const std::vector<std::vector<size_t>> inputShapes_IC = {{4, 5}, {3, 7}};
|
||||
const std::vector<ov::element::Type> arg_depth_type_ic = { ov::element::i32 };
|
||||
const std::vector<int64_t> arg_depth_ic = { 1, 5, 1017 };
|
||||
const std::vector<ov::element::Type> arg_set_type_ic = { ov::element::i32 };
|
||||
const std::vector<float> arg_on_value_ic = { 0, 1, -29 };
|
||||
const std::vector<float> arg_off_value_ic = { 0, 1, -127 };
|
||||
const std::vector<int64_t> arg_axis_ic = {0};
|
||||
const std::vector<std::vector<ov::Shape>> input_shapes_ic = {{{4, 5}}, {{3, 7}}};
|
||||
|
||||
const auto oneHotParams_IC = testing::Combine(
|
||||
testing::ValuesIn(argDepthType_IC),
|
||||
testing::ValuesIn(argDepth_IC),
|
||||
testing::ValuesIn(argSetType_IC),
|
||||
testing::ValuesIn(argOnValue_IC),
|
||||
testing::ValuesIn(argOffValue_IC),
|
||||
testing::ValuesIn(argAxis_IC),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::ValuesIn(inputShapes_IC),
|
||||
const auto oneHotParams_ic = testing::Combine(
|
||||
testing::ValuesIn(arg_depth_type_ic),
|
||||
testing::ValuesIn(arg_depth_ic),
|
||||
testing::ValuesIn(arg_set_type_ic),
|
||||
testing::ValuesIn(arg_on_value_ic),
|
||||
testing::ValuesIn(arg_off_value_ic),
|
||||
testing::ValuesIn(arg_axis_ic),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_ic)),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OneHotIntConst,
|
||||
OneHotLayerTest,
|
||||
oneHotParams_IC,
|
||||
oneHotParams_ic,
|
||||
OneHotLayerTest::getTestCaseName
|
||||
);
|
||||
|
||||
|
||||
const std::vector<ngraph::element::Type> argDepthType_Ax = { ngraph::element::i32 };
|
||||
const std::vector<int64_t> argDepth_Ax = { 3 };
|
||||
const std::vector<ngraph::element::Type> argSetType_Ax = { ngraph::element::i32, ngraph::element::f32 };
|
||||
const std::vector<float> argOnValue_Ax = { 17 };
|
||||
const std::vector<float> argOffValue_Ax = { -3 };
|
||||
const std::vector<int64_t> argAxis_Ax = {0, 1, 3, 5, -4, -5};
|
||||
const std::vector<std::vector<size_t>> inputShapes_Ax = {{4, 8, 5, 3, 2, 9}};
|
||||
const std::vector<ov::element::Type> arg_depth_type_ax = { ov::element::i32 };
|
||||
const std::vector<int64_t> arg_depth_ax = { 3 };
|
||||
const std::vector<ov::element::Type> arg_set_type_ax = { ov::element::i32, ov::element::f32 };
|
||||
const std::vector<float> arg_on_value_ax = { 17 };
|
||||
const std::vector<float> arg_off_value_ax = { -3 };
|
||||
const std::vector<int64_t> arg_axis_ax = {0, 1, 3, 5, -4, -5};
|
||||
const std::vector<std::vector<ov::Shape>> input_shapes_ax = {{{4, 8, 5, 3, 2, 9}}};
|
||||
|
||||
const auto oneHotParams_Ax = testing::Combine(
|
||||
testing::ValuesIn(argDepthType_Ax),
|
||||
testing::ValuesIn(argDepth_Ax),
|
||||
testing::ValuesIn(argSetType_Ax),
|
||||
testing::ValuesIn(argOnValue_Ax),
|
||||
testing::ValuesIn(argOffValue_Ax),
|
||||
testing::ValuesIn(argAxis_Ax),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::ValuesIn(inputShapes_Ax),
|
||||
const auto oneHotParams_ax = testing::Combine(
|
||||
testing::ValuesIn(arg_depth_type_ax),
|
||||
testing::ValuesIn(arg_depth_ax),
|
||||
testing::ValuesIn(arg_set_type_ax),
|
||||
testing::ValuesIn(arg_on_value_ax),
|
||||
testing::ValuesIn(arg_off_value_ax),
|
||||
testing::ValuesIn(arg_axis_ax),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_ax)),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OneHotAxrng,
|
||||
OneHotLayerTest,
|
||||
oneHotParams_Ax,
|
||||
oneHotParams_ax,
|
||||
OneHotLayerTest::getTestCaseName
|
||||
);
|
||||
|
||||
|
||||
const std::vector<ngraph::element::Type> argDepthType_T = { ngraph::element::i8, ngraph::element::u8 };
|
||||
const std::vector<int64_t> argDepth_T = { 1 };
|
||||
const std::vector<ngraph::element::Type> argSetType_T = { ngraph::element::i8, ngraph::element::u8,
|
||||
ngraph::element::bf16, ngraph::element::f32 };
|
||||
const std::vector<float> argOnValue_T = { 1 };
|
||||
const std::vector<float> argOffValue_T = { 1 };
|
||||
const std::vector<int64_t> argAxis_T = {-1};
|
||||
const std::vector<std::vector<size_t>> inputShapes_T = {{2, 2}};
|
||||
const std::vector<ov::element::Type> arg_depth_type_t = { ov::element::i8, ov::element::u8 };
|
||||
const std::vector<int64_t> arg_depth_t = { 1 };
|
||||
const std::vector<ov::element::Type> arg_set_type_t = { ov::element::i8, ov::element::u8,
|
||||
ov::element::bf16, ov::element::f32 };
|
||||
const std::vector<float> arg_on_value_t = { 1 };
|
||||
const std::vector<float> arg_off_value_t = { 1 };
|
||||
const std::vector<int64_t> arg_axis_t = {-1};
|
||||
const std::vector<std::vector<ov::Shape>> input_shapes_t = {{{2, 2}}};
|
||||
|
||||
const auto oneHotParams_T = testing::Combine(
|
||||
testing::ValuesIn(argDepthType_T),
|
||||
testing::ValuesIn(argDepth_T),
|
||||
testing::ValuesIn(argSetType_T),
|
||||
testing::ValuesIn(argOnValue_T),
|
||||
testing::ValuesIn(argOffValue_T),
|
||||
testing::ValuesIn(argAxis_T),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::ValuesIn(inputShapes_T),
|
||||
const auto oneHotParams_t = testing::Combine(
|
||||
testing::ValuesIn(arg_depth_type_t),
|
||||
testing::ValuesIn(arg_depth_t),
|
||||
testing::ValuesIn(arg_set_type_t),
|
||||
testing::ValuesIn(arg_on_value_t),
|
||||
testing::ValuesIn(arg_off_value_t),
|
||||
testing::ValuesIn(arg_axis_t),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_t)),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_OneHotArgType,
|
||||
OneHotLayerTest,
|
||||
oneHotParams_T,
|
||||
oneHotParams_t,
|
||||
OneHotLayerTest::getTestCaseName
|
||||
);
|
||||
} // namespace
|
||||
|
@ -4,42 +4,45 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "single_layer_tests/pad.hpp"
|
||||
|
||||
using namespace LayerTestsDefinitions;
|
||||
#include "single_op_tests/pad.hpp"
|
||||
|
||||
namespace {
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::I32,
|
||||
InferenceEngine::Precision::FP16,
|
||||
InferenceEngine::Precision::I16,
|
||||
InferenceEngine::Precision::U16,
|
||||
InferenceEngine::Precision::I8,
|
||||
InferenceEngine::Precision::U8,
|
||||
using ov::test::PadLayerTest;
|
||||
using ov::op::PadMode;
|
||||
|
||||
const std::vector<ov::element::Type> model_types = {
|
||||
ov::element::f32,
|
||||
ov::element::i32,
|
||||
ov::element::f16,
|
||||
ov::element::i16,
|
||||
ov::element::u16,
|
||||
ov::element::i8,
|
||||
ov::element::u8,
|
||||
};
|
||||
|
||||
const std::vector<float> argPadValue = {0.f, 1.f, -1.f, 2.5f};
|
||||
const std::vector<float> arg_pad_values = {0.f, 1.f, -1.f, 2.5f};
|
||||
|
||||
const std::vector<ngraph::helpers::PadMode> padMode = {
|
||||
ngraph::helpers::PadMode::EDGE,
|
||||
ngraph::helpers::PadMode::REFLECT,
|
||||
ngraph::helpers::PadMode::SYMMETRIC
|
||||
const std::vector<PadMode> pad_modes = {
|
||||
PadMode::EDGE,
|
||||
PadMode::REFLECT,
|
||||
PadMode::SYMMETRIC
|
||||
};
|
||||
|
||||
const std::vector<std::vector<int64_t>> padsBegin1D = {{0}, {1}, {2}, {-2}};
|
||||
const std::vector<std::vector<int64_t>> padsEnd1D = {{0}, {1}, {2}, {-2}};
|
||||
|
||||
// 1D
|
||||
|
||||
const std::vector<std::vector<int64_t>> pads_begin_1d = {{0}, {1}, {2}, {-2}};
|
||||
const std::vector<std::vector<int64_t>> pads_end_1d = {{0}, {1}, {2}, {-2}};
|
||||
|
||||
const std::vector<ov::Shape> input_shape_1d_static = {{5}};
|
||||
|
||||
const auto pad1DConstparams = testing::Combine(
|
||||
testing::ValuesIn(padsBegin1D),
|
||||
testing::ValuesIn(padsEnd1D),
|
||||
testing::ValuesIn(argPadValue),
|
||||
testing::Values(ngraph::helpers::PadMode::CONSTANT),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
testing::Values(InferenceEngine::Layout::ANY),
|
||||
testing::Values(std::vector<size_t>{5}),
|
||||
testing::ValuesIn(pads_begin_1d),
|
||||
testing::ValuesIn(pads_end_1d),
|
||||
testing::ValuesIn(arg_pad_values),
|
||||
testing::Values(PadMode::CONSTANT),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::Values(ov::test::static_shapes_to_test_representation(input_shape_1d_static)),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
@ -51,15 +54,12 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
);
|
||||
|
||||
const auto pad1Dparams = testing::Combine(
|
||||
testing::ValuesIn(padsBegin1D),
|
||||
testing::ValuesIn(padsEnd1D),
|
||||
testing::ValuesIn(pads_begin_1d),
|
||||
testing::ValuesIn(pads_end_1d),
|
||||
testing::Values(0),
|
||||
testing::ValuesIn(padMode),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
testing::Values(InferenceEngine::Layout::ANY),
|
||||
testing::Values(std::vector<size_t>{5}),
|
||||
testing::ValuesIn(pad_modes),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::Values(ov::test::static_shapes_to_test_representation(input_shape_1d_static)),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
@ -70,19 +70,21 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
PadLayerTest::getTestCaseName
|
||||
);
|
||||
|
||||
const std::vector<std::vector<int64_t>> padsBegin2D = {{0, 0}, {1, 1}, {-2, 0}, {0, 3}};
|
||||
const std::vector<std::vector<int64_t>> padsEnd2D = {{0, 0}, {1, 1}, {0, 1}, {-3, -2}};
|
||||
|
||||
// 2D
|
||||
|
||||
const std::vector<std::vector<int64_t>> pads_begin_2d = {{0, 0}, {1, 1}, {-2, 0}, {0, 3}};
|
||||
const std::vector<std::vector<int64_t>> pads_end_2d = {{0, 0}, {1, 1}, {0, 1}, {-3, -2}};
|
||||
|
||||
const std::vector<ov::Shape> input_shape_2d_static = {{13, 5}};
|
||||
|
||||
const auto pad2DConstparams = testing::Combine(
|
||||
testing::ValuesIn(padsBegin2D),
|
||||
testing::ValuesIn(padsEnd2D),
|
||||
testing::ValuesIn(argPadValue),
|
||||
testing::Values(ngraph::helpers::PadMode::CONSTANT),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
testing::Values(InferenceEngine::Layout::ANY),
|
||||
testing::Values(std::vector<size_t>{13, 5}),
|
||||
testing::ValuesIn(pads_begin_2d),
|
||||
testing::ValuesIn(pads_end_2d),
|
||||
testing::ValuesIn(arg_pad_values),
|
||||
testing::Values(PadMode::CONSTANT),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::Values(ov::test::static_shapes_to_test_representation(input_shape_2d_static)),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
@ -94,15 +96,12 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
);
|
||||
|
||||
const auto pad2Dparams = testing::Combine(
|
||||
testing::ValuesIn(padsBegin2D),
|
||||
testing::ValuesIn(padsEnd2D),
|
||||
testing::ValuesIn(pads_begin_2d),
|
||||
testing::ValuesIn(pads_end_2d),
|
||||
testing::Values(0),
|
||||
testing::ValuesIn(padMode),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
testing::Values(InferenceEngine::Layout::ANY),
|
||||
testing::Values(std::vector<size_t>{13, 5}),
|
||||
testing::ValuesIn(pad_modes),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::Values(ov::test::static_shapes_to_test_representation(input_shape_2d_static)),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
@ -113,19 +112,21 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
PadLayerTest::getTestCaseName
|
||||
);
|
||||
|
||||
const std::vector<std::vector<int64_t>> padsBegin4D = {{0, 0, 0, 0}, {0, 3, 0, 0}, {0, 0, 0, 1}, {0, 0, -1, 1}, {2, 0, 0, 0}, {0, 3, 0, -1}};
|
||||
const std::vector<std::vector<int64_t>> padsEnd4D = {{0, 0, 0, 0}, {0, 3, 0, 0}, {1, 0, 0, 0}, {0, 0, 0, 2}, {1, -3, 0, 0}, {0, 3, 0, -1}};
|
||||
|
||||
// 4D
|
||||
|
||||
const std::vector<std::vector<int64_t>> pads_begin_4d = {{0, 0, 0, 0}, {0, 3, 0, 0}, {0, 0, 0, 1}, {0, 0, -1, 1}, {2, 0, 0, 0}, {0, 3, 0, -1}};
|
||||
const std::vector<std::vector<int64_t>> pads_end_4d = {{0, 0, 0, 0}, {0, 3, 0, 0}, {1, 0, 0, 0}, {0, 0, 0, 2}, {1, -3, 0, 0}, {0, 3, 0, -1}};
|
||||
|
||||
const std::vector<ov::Shape> input_shape_4d_static = {{3, 5, 10, 11}};
|
||||
|
||||
const auto pad4DConstparams = testing::Combine(
|
||||
testing::ValuesIn(padsBegin4D),
|
||||
testing::ValuesIn(padsEnd4D),
|
||||
testing::ValuesIn(argPadValue),
|
||||
testing::Values(ngraph::helpers::PadMode::CONSTANT),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
testing::Values(InferenceEngine::Layout::ANY),
|
||||
testing::Values(std::vector<size_t>{3, 5, 10, 11}),
|
||||
testing::ValuesIn(pads_begin_4d),
|
||||
testing::ValuesIn(pads_end_4d),
|
||||
testing::ValuesIn(arg_pad_values),
|
||||
testing::Values(PadMode::CONSTANT),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::Values(ov::test::static_shapes_to_test_representation(input_shape_4d_static)),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
@ -137,15 +138,12 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
);
|
||||
|
||||
const auto pad4Dparams = testing::Combine(
|
||||
testing::ValuesIn(padsBegin4D),
|
||||
testing::ValuesIn(padsEnd4D),
|
||||
testing::ValuesIn(pads_begin_4d),
|
||||
testing::ValuesIn(pads_end_4d),
|
||||
testing::Values(0),
|
||||
testing::ValuesIn(padMode),
|
||||
testing::ValuesIn(netPrecisions),
|
||||
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
testing::Values(InferenceEngine::Layout::ANY),
|
||||
testing::Values(std::vector<size_t>{3, 5, 10, 11}),
|
||||
testing::ValuesIn(pad_modes),
|
||||
testing::ValuesIn(model_types),
|
||||
testing::Values(ov::test::static_shapes_to_test_representation(input_shape_4d_static)),
|
||||
testing::Values(ov::test::utils::DEVICE_CPU)
|
||||
);
|
||||
|
||||
@ -155,5 +153,4 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
pad4Dparams,
|
||||
PadLayerTest::getTestCaseName
|
||||
);
|
||||
|
||||
} // namespace
|
||||
|
@ -64,8 +64,6 @@ std::vector<std::string> disabledTestPatterns() {
|
||||
R"(.*BF16NetworkRestore1.*)",
|
||||
R"(.*MobileNet_ssd_with_branching.*)",
|
||||
|
||||
// TODO: 57562 No dynamic output shape support
|
||||
R"(.*NonZeroLayerTest.*)",
|
||||
// Not expected behavior
|
||||
R"(.*Behavior.*InferRequestSetBlobByType.*Batched.*)",
|
||||
R"(.*OVCompiledModelBaseTest.*(CanGetInputsInfoAndCheck|canSetConfigToCompiledModel).*)",
|
||||
|
@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared_test_classes/single_op/nonzero.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
TEST_P(NonZeroLayerTest, Inference) {
|
||||
run();
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared_test_classes/single_op/normalize_l2.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
TEST_P(NormalizeL2LayerTest, Inference) {
|
||||
run();
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared_test_classes/single_op/one_hot.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
TEST_P(OneHotLayerTest, Inference) {
|
||||
run();
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared_test_classes/single_op/pad.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
TEST_P(PadLayerTest, Inference) {
|
||||
run();
|
||||
}
|
||||
|
||||
TEST_P(Pad12LayerTest, Inference) {
|
||||
run();
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,31 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tuple>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
using NonZeroLayerTestParamsSet = typename std::tuple<
|
||||
std::vector<InputShape>, // Input shapes
|
||||
ov::element::Type, // Model shape
|
||||
std::string, // Device name
|
||||
std::map<std::string, std::string>>; // Additional network configuration
|
||||
|
||||
class NonZeroLayerTest : public testing::WithParamInterface<NonZeroLayerTestParamsSet>,
|
||||
virtual public ov::test::SubgraphBaseTest {
|
||||
public:
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<NonZeroLayerTestParamsSet>& obj);
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
using NormalizeL2LayerTestParams = std::tuple<
|
||||
std::vector<int64_t>, // axes
|
||||
float, // eps
|
||||
ov::op::EpsMode, // eps mode
|
||||
std::vector<InputShape>, // input shape
|
||||
ov::element::Type, // model type
|
||||
std::string // target device
|
||||
>;
|
||||
|
||||
class NormalizeL2LayerTest : public testing::WithParamInterface<NormalizeL2LayerTestParams>,
|
||||
virtual public ov::test::SubgraphBaseTest {
|
||||
public:
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<NormalizeL2LayerTestParams>& obj);
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
};
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
typedef std::tuple<
|
||||
ov::element::Type, // depth type (any integer type)
|
||||
int64_t, // depth value
|
||||
ov::element::Type, // On & Off values type (any supported type)
|
||||
float, // OnValue
|
||||
float, // OffValue
|
||||
int64_t, // axis
|
||||
ov::element::Type, // Model type
|
||||
std::vector<InputShape>, // Input shapes
|
||||
std::string // Target device name
|
||||
> oneHotLayerTestParamsSet;
|
||||
|
||||
class OneHotLayerTest : public testing::WithParamInterface<oneHotLayerTestParamsSet>,
|
||||
virtual public ov::test::SubgraphBaseTest {
|
||||
public:
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<oneHotLayerTestParamsSet>& obj);
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,48 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||
#include "openvino/op/util/attr_types.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
typedef std::tuple<
|
||||
std::vector<int64_t>, // padsBegin
|
||||
std::vector<int64_t>, // padsEnd
|
||||
float, // argPadValue
|
||||
ov::op::PadMode, // padMode
|
||||
ov::element::Type, // Net precision
|
||||
std::vector<InputShape>, // Input shapes
|
||||
std::string // Target device name
|
||||
> padLayerTestParamsSet;
|
||||
|
||||
class PadLayerTest : public testing::WithParamInterface<padLayerTestParamsSet>,
|
||||
virtual public ov::test::SubgraphBaseTest {
|
||||
public:
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<padLayerTestParamsSet>& obj);
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
virtual std::shared_ptr<ov::Node> create_pad_op(const std::shared_ptr<ov::Node>&,
|
||||
const std::shared_ptr<ov::Node>&,
|
||||
const std::shared_ptr<ov::Node>&,
|
||||
const std::shared_ptr<ov::Node>&,
|
||||
ov::op::PadMode) const;
|
||||
};
|
||||
|
||||
class Pad12LayerTest : public PadLayerTest {
|
||||
std::shared_ptr<ov::Node> create_pad_op(const std::shared_ptr<ov::Node>&,
|
||||
const std::shared_ptr<ov::Node>&,
|
||||
const std::shared_ptr<ov::Node>&,
|
||||
const std::shared_ptr<ov::Node>&,
|
||||
ov::op::PadMode) const override;
|
||||
};
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -1184,6 +1184,18 @@ ov::runtime::Tensor generate(const
|
||||
return tensor;
|
||||
}
|
||||
|
||||
ov::runtime::Tensor generate(const
|
||||
std::shared_ptr<ov::op::v0::NormalizeL2>& node,
|
||||
size_t port,
|
||||
const ov::element::Type& elemType,
|
||||
const ov::Shape& targetShape) {
|
||||
if (port == 0) {
|
||||
InputGenerateData inGenData(-5, 10, 7, 222);
|
||||
return ov::test::utils::create_and_fill_tensor(elemType, targetShape, inGenData.range, inGenData.start_from, inGenData.resolution, inGenData.seed);
|
||||
}
|
||||
return generate(std::dynamic_pointer_cast<ov::Node>(node), port, elemType, targetShape);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ov::runtime::Tensor generateInput(const std::shared_ptr<ov::Node>& node,
|
||||
size_t port,
|
||||
|
@ -0,0 +1,57 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_op/nonzero.hpp"
|
||||
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/result.hpp"
|
||||
#include "openvino/op/non_zero.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
|
||||
std::string NonZeroLayerTest::getTestCaseName(const testing::TestParamInfo<NonZeroLayerTestParamsSet>& obj) {
|
||||
std::vector<InputShape> shapes;
|
||||
ov::element::Type model_type;
|
||||
std::string target_device;
|
||||
std::map<std::string, std::string> additional_config;
|
||||
std::tie(shapes, model_type, target_device, additional_config) = obj.param;
|
||||
|
||||
std::ostringstream result;
|
||||
result << "IS=(";
|
||||
for (size_t i = 0lu; i < shapes.size(); i++) {
|
||||
result << ov::test::utils::partialShape2str({shapes[i].first}) << (i < shapes.size() - 1lu ? "_" : "");
|
||||
}
|
||||
result << ")_TS=";
|
||||
for (size_t i = 0lu; i < shapes.front().second.size(); i++) {
|
||||
result << "{";
|
||||
for (size_t j = 0lu; j < shapes.size(); j++) {
|
||||
result << ov::test::utils::vec2str(shapes[j].second[i]) << (j < shapes.size() - 1lu ? "_" : "");
|
||||
}
|
||||
result << "}_";
|
||||
}
|
||||
result << "inPRC=" << model_type.get_type_name() << "_";
|
||||
result << "targetDevice=" << target_device;
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void NonZeroLayerTest::SetUp() {
|
||||
std::vector<InputShape> shapes;
|
||||
ov::element::Type model_type;
|
||||
std::map<std::string, std::string> additional_config;
|
||||
std::tie(shapes, model_type, targetDevice, additional_config) = GetParam();
|
||||
configuration.insert(additional_config.cbegin(), additional_config.cend());
|
||||
init_input_shapes(shapes);
|
||||
|
||||
auto param = std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes.front());
|
||||
|
||||
auto non_zero = std::make_shared<ov::op::v3::NonZero>(param);
|
||||
|
||||
auto result = std::make_shared<ov::op::v0::Result>(non_zero);
|
||||
|
||||
function = std::make_shared<ov::Model>(result, ov::ParameterVector{param}, "non_zero");
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,62 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_op/normalize_l2.hpp"
|
||||
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/result.hpp"
|
||||
#include "openvino/op/normalize_l2.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
std::string NormalizeL2LayerTest::getTestCaseName(const testing::TestParamInfo<NormalizeL2LayerTestParams>& obj) {
|
||||
std::vector<int64_t> axes;
|
||||
float eps;
|
||||
ngraph::op::EpsMode eps_mode;
|
||||
std::vector<InputShape> shapes;
|
||||
ov::element::Type model_type;
|
||||
std::string targetDevice;
|
||||
std::tie(axes, eps, eps_mode, shapes, model_type, targetDevice) = obj.param;
|
||||
|
||||
std::ostringstream result;
|
||||
result << "IS=(";
|
||||
for (size_t i = 0lu; i < shapes.size(); i++) {
|
||||
result << ov::test::utils::partialShape2str({shapes[i].first}) << (i < shapes.size() - 1lu ? "_" : "");
|
||||
}
|
||||
result << ")_TS=";
|
||||
for (size_t i = 0lu; i < shapes.front().second.size(); i++) {
|
||||
result << "{";
|
||||
for (size_t j = 0lu; j < shapes.size(); j++) {
|
||||
result << ov::test::utils::vec2str(shapes[j].second[i]) << (j < shapes.size() - 1lu ? "_" : "");
|
||||
}
|
||||
result << "}_";
|
||||
}
|
||||
result << "axes=" << ov::test::utils::vec2str(axes) << "_";
|
||||
result << "eps=" << eps << "_";
|
||||
result << "eps_mode=" << eps_mode << "_";
|
||||
result << "netPRC=" << model_type.get_type_name() << "_";
|
||||
result << "targetDevice=" << targetDevice;
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void NormalizeL2LayerTest::SetUp() {
|
||||
std::vector<InputShape> shapes;
|
||||
std::vector<int64_t> axes;
|
||||
float eps;
|
||||
ngraph::op::EpsMode eps_mode;
|
||||
ov::element::Type model_type;
|
||||
std::tie(axes, eps, eps_mode, shapes, model_type, targetDevice) = this->GetParam();
|
||||
init_input_shapes(shapes);
|
||||
|
||||
auto param = std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes.front());
|
||||
|
||||
auto norm_axes = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{axes.size()}, axes);
|
||||
auto norm = std::make_shared<ov::op::v0::NormalizeL2>(param, norm_axes, eps, eps_mode);
|
||||
|
||||
auto result = std::make_shared<ov::op::v0::Result>(norm);
|
||||
function = std::make_shared<ov::Model>(result, ov::ParameterVector{param}, "NormalizeL2");
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,71 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_op/one_hot.hpp"
|
||||
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/result.hpp"
|
||||
#include "openvino/op/one_hot.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
std::string OneHotLayerTest::getTestCaseName(const testing::TestParamInfo<oneHotLayerTestParamsSet>& obj) {
|
||||
int64_t axis;
|
||||
ov::element::Type depth_type, set_type;
|
||||
int64_t depth_val;
|
||||
float on_val, off_val;
|
||||
ov::element::Type model_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::string targetDevice;
|
||||
|
||||
std::tie(depth_type, depth_val, set_type, on_val, off_val, axis, model_type, shapes, targetDevice) = obj.param;
|
||||
|
||||
std::ostringstream result;
|
||||
result << "IS=(";
|
||||
for (size_t i = 0lu; i < shapes.size(); i++) {
|
||||
result << ov::test::utils::partialShape2str({shapes[i].first}) << (i < shapes.size() - 1lu ? "_" : "");
|
||||
}
|
||||
result << ")_TS=";
|
||||
for (size_t i = 0lu; i < shapes.front().second.size(); i++) {
|
||||
result << "{";
|
||||
for (size_t j = 0lu; j < shapes.size(); j++) {
|
||||
result << ov::test::utils::vec2str(shapes[j].second[i]) << (j < shapes.size() - 1lu ? "_" : "");
|
||||
}
|
||||
result << "}_";
|
||||
}
|
||||
result << "depthType=" << depth_type << "_";
|
||||
result << "depth=" << depth_val << "_";
|
||||
result << "SetValueType=" << set_type << "_";
|
||||
result << "onValue=" << on_val << "_";
|
||||
result << "offValue=" << off_val << "_";
|
||||
result << "axis=" << axis << "_";
|
||||
|
||||
result << "netPRC=" << model_type.get_type_name() << "_";
|
||||
result << "trgDev=" << targetDevice;
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void OneHotLayerTest::SetUp() {
|
||||
int64_t axis;
|
||||
ov::element::Type depth_type, set_type;
|
||||
int64_t depth_val;
|
||||
float on_val, off_val;
|
||||
ov::element::Type model_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::tie(depth_type, depth_val, set_type, on_val, off_val, axis, model_type, shapes, targetDevice) = this->GetParam();
|
||||
init_input_shapes(shapes);
|
||||
|
||||
auto param = std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes.front());
|
||||
|
||||
auto depth_const = std::make_shared<ov::op::v0::Constant>(depth_type, ov::Shape{}, depth_val);
|
||||
auto on_value_const = std::make_shared<ov::op::v0::Constant>(set_type, ov::Shape{}, on_val);
|
||||
auto off_value_const = std::make_shared<ov::op::v0::Constant>(set_type, ov::Shape{}, off_val);
|
||||
auto onehot = std::make_shared<ov::op::v1::OneHot>(param, depth_const, on_value_const, off_value_const, axis);
|
||||
|
||||
auto result = std::make_shared<ov::op::v0::Result>(onehot);
|
||||
function = std::make_shared<ngraph::Function>(result, ov::ParameterVector{param}, "OneHot");
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,85 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_op/pad.hpp"
|
||||
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/result.hpp"
|
||||
#include "openvino/op/pad.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
std::string PadLayerTest::getTestCaseName(const testing::TestParamInfo<padLayerTestParamsSet>& obj) {
|
||||
ov::element::Type model_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::vector<int64_t> pads_begin, pads_end;
|
||||
ov::op::PadMode pad_mode;
|
||||
float arg_pad_value;
|
||||
std::string target_device;
|
||||
std::tie(pads_begin, pads_end, arg_pad_value, pad_mode, model_type, shapes, target_device) = obj.param;
|
||||
|
||||
std::ostringstream result;
|
||||
result << "IS=(";
|
||||
for (size_t i = 0lu; i < shapes.size(); i++) {
|
||||
result << ov::test::utils::partialShape2str({shapes[i].first}) << (i < shapes.size() - 1lu ? "_" : "");
|
||||
}
|
||||
result << ")_TS=";
|
||||
for (size_t i = 0lu; i < shapes.front().second.size(); i++) {
|
||||
result << "{";
|
||||
for (size_t j = 0lu; j < shapes.size(); j++) {
|
||||
result << ov::test::utils::vec2str(shapes[j].second[i]) << (j < shapes.size() - 1lu ? "_" : "");
|
||||
}
|
||||
result << "}_";
|
||||
}
|
||||
result << "PadsBegin=" << ov::test::utils::vec2str(pads_begin) << "_";
|
||||
result << "PadsEnd=" << ov::test::utils::vec2str(pads_end) << "_";
|
||||
if (pad_mode == ov::op::PadMode::CONSTANT) {
|
||||
result << "Value=" << arg_pad_value << "_";
|
||||
}
|
||||
result << "PadMode=" << pad_mode << "_";
|
||||
result << "ModelType=" << model_type.get_type_name() << "_";
|
||||
result << "TrgDev=" << target_device;
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void PadLayerTest::SetUp() {
|
||||
ov::element::Type model_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::vector<int64_t> pads_begin, pads_end;
|
||||
ov::op::PadMode pad_mode;
|
||||
float arg_pad_value;
|
||||
std::tie(pads_begin, pads_end, arg_pad_value, pad_mode, model_type, shapes, targetDevice) = this->GetParam();
|
||||
init_input_shapes(shapes);
|
||||
|
||||
auto param = std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes.front());
|
||||
|
||||
auto pads_begin_const = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{pads_begin.size()}, pads_begin.data());
|
||||
auto pads_end_const = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{pads_end.size()}, pads_end.data());
|
||||
auto arg_pad_value_const = std::make_shared<ov::op::v0::Constant>(model_type, ov::Shape{}, &arg_pad_value);
|
||||
|
||||
auto pad = create_pad_op(param, pads_begin_const, pads_end_const, arg_pad_value_const, pad_mode);
|
||||
|
||||
auto result = std::make_shared<ov::op::v0::Result>(pad);
|
||||
|
||||
function = std::make_shared<ov::Model>(result, ov::ParameterVector{param}, "pad");
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::Node> PadLayerTest::create_pad_op(const std::shared_ptr<ov::Node>& data,
|
||||
const std::shared_ptr<ov::Node>& pads_begin,
|
||||
const std::shared_ptr<ov::Node>& pads_end,
|
||||
const std::shared_ptr<ov::Node>& arg_pad_value,
|
||||
ov::op::PadMode pad_mode) const {
|
||||
return std::make_shared<ov::op::v1::Pad>(data, pads_begin, pads_end, arg_pad_value, pad_mode);
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::Node> Pad12LayerTest::create_pad_op(const std::shared_ptr<ov::Node>& data,
|
||||
const std::shared_ptr<ov::Node>& pads_begin,
|
||||
const std::shared_ptr<ov::Node>& pads_end,
|
||||
const std::shared_ptr<ov::Node>& arg_pad_value,
|
||||
ov::op::PadMode pad_mode) const {
|
||||
return std::make_shared<ov::op::v12::Pad>(data, pads_begin, pads_end, arg_pad_value, pad_mode);
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
Loading…
Reference in New Issue
Block a user