TileLayerTest to API2.0 (#19770)
* `TileLayerTest` to API2.0 * Remove `ngraph::` use * Fix cpplint
This commit is contained in:
1 parent
7445f5bea6
commit
972bb73298
6 files changed
+131
-41
No files matched your search
+30
-38
@@ -4,32 +4,32 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "single_layer_tests/tile.hpp"
|
||||
#include "single_op_tests/tile.hpp"
|
||||
|
||||
using namespace LayerTestsDefinitions;
|
||||
using ov::test::TileLayerTest;
|
||||
|
||||
namespace {
|
||||
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::I8,
|
||||
InferenceEngine::Precision::U8,
|
||||
InferenceEngine::Precision::I32,
|
||||
InferenceEngine::Precision::BF16,
|
||||
InferenceEngine::Precision::FP32
|
||||
const std::vector<ov::element::Type> model_types = {
|
||||
ov::element::i8,
|
||||
ov::element::u8,
|
||||
ov::element::i32,
|
||||
ov::element::bf16,
|
||||
ov::element::f32
|
||||
};
|
||||
|
||||
const std::vector<InferenceEngine::Precision> netTPrecisions = {
|
||||
InferenceEngine::Precision::I64,
|
||||
InferenceEngine::Precision::I16,
|
||||
InferenceEngine::Precision::FP16,
|
||||
const std::vector<ov::element::Type> model_t_types = {
|
||||
ov::element::i64,
|
||||
ov::element::i16,
|
||||
ov::element::f16,
|
||||
};
|
||||
|
||||
const std::vector<std::vector<size_t>> inputShapes = {
|
||||
{2, 3, 4},
|
||||
{1, 1, 1},
|
||||
const std::vector<std::vector<ov::Shape>> input_shape_static_3D = {
|
||||
{{2, 3, 4}},
|
||||
{{1, 1, 1}},
|
||||
};
|
||||
|
||||
const std::vector<std::vector<int64_t>> repeats3D = {
|
||||
const std::vector<std::vector<int64_t>> repeats_3D = {
|
||||
{1, 2, 3},
|
||||
{1, 1, 2, 3},
|
||||
{1, 2, 1, 3},
|
||||
@@ -41,42 +41,34 @@ const std::vector<std::vector<int64_t>> repeats3D = {
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Tile, TileLayerTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(repeats3D),
|
||||
::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(inputShapes),
|
||||
::testing::ValuesIn(repeats_3D),
|
||||
::testing::ValuesIn(model_types),
|
||||
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shape_static_3D)),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
||||
TileLayerTest::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_PrecTransformation, TileLayerTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(repeats3D[0]),
|
||||
::testing::ValuesIn(netTPrecisions),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Precision::UNSPECIFIED),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(InferenceEngine::Layout::ANY),
|
||||
::testing::Values(inputShapes[0]),
|
||||
::testing::Values(repeats_3D[0]),
|
||||
::testing::ValuesIn(model_t_types),
|
||||
::testing::Values(ov::test::static_shapes_to_test_representation(input_shape_static_3D)[0]),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
||||
TileLayerTest::getTestCaseName);
|
||||
|
||||
const std::vector<std::vector<int64_t>> repeats6D = {
|
||||
const std::vector<std::vector<int64_t>> repeats_6D = {
|
||||
{1, 1, 1, 2, 1, 2},
|
||||
{1, 1, 1, 1, 1, 1}
|
||||
};
|
||||
|
||||
const std::vector<std::vector<ov::Shape>> input_shape_static_6D = {
|
||||
{{1, 4, 3, 1, 3, 1}}
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_Tile6d, TileLayerTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(repeats6D),
|
||||
::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, 4, 3, 1, 3, 1})),
|
||||
::testing::ValuesIn(repeats_6D),
|
||||
::testing::ValuesIn(model_types),
|
||||
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shape_static_6D)),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
||||
TileLayerTest::getTestCaseName);
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared_test_classes/single_op/tile.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
TEST_P(TileLayerTest, Inference) {
|
||||
run();
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
typedef std::vector<int64_t> TileSpecificParams;
|
||||
typedef std::tuple<
|
||||
TileSpecificParams,
|
||||
ov::element::Type, // Model type
|
||||
std::vector<InputShape>, // Input shapes
|
||||
ov::test::TargetDevice // Device name
|
||||
> TileLayerTestParamsSet;
|
||||
|
||||
class TileLayerTest : public testing::WithParamInterface<TileLayerTestParamsSet>,
|
||||
virtual public ov::test::SubgraphBaseTest {
|
||||
public:
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<TileLayerTestParamsSet>& obj);
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
};
|
||||
} // namespace test
|
||||
} // namespace ov
|
||||
@@ -0,0 +1,49 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_op/tile.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
std::string TileLayerTest::getTestCaseName(const testing::TestParamInfo<TileLayerTestParamsSet>& obj) {
|
||||
TileSpecificParams tile_params;
|
||||
ov::element::Type model_type;
|
||||
std::vector<InputShape> input_shapes;
|
||||
std::string target_device;
|
||||
std::tie(tile_params, model_type, input_shapes, target_device) = obj.param;
|
||||
|
||||
std::ostringstream result;
|
||||
result << "IS=(";
|
||||
for (size_t i = 0lu; i < input_shapes.size(); i++) {
|
||||
result << ov::test::utils::partialShape2str({input_shapes[i].first})
|
||||
<< (i < input_shapes.size() - 1lu ? "_" : "");
|
||||
}
|
||||
result << ")_TS=";
|
||||
for (size_t i = 0lu; i < input_shapes.front().second.size(); i++) {
|
||||
result << "{";
|
||||
for (size_t j = 0lu; j < input_shapes.size(); j++) {
|
||||
result << ov::test::utils::vec2str(input_shapes[j].second[i]) << (j < input_shapes.size() - 1lu ? "_" : "");
|
||||
}
|
||||
result << "}_";
|
||||
}
|
||||
result << "Repeats=" << ov::test::utils::vec2str(tile_params) << "_";
|
||||
result << "modelType=" << model_type.to_string() << "_";
|
||||
result << "trgDev=" << target_device;
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void TileLayerTest::SetUp() {
|
||||
TileSpecificParams tile_params;
|
||||
ov::element::Type model_type;
|
||||
std::vector<InputShape> input_shapes;
|
||||
std::tie(tile_params, model_type, input_shapes, targetDevice) = this->GetParam();
|
||||
init_input_shapes({input_shapes});
|
||||
|
||||
auto param = std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes.front());
|
||||
auto repeats = std::make_shared<ov::op::v0::Constant>(ov::element::i64, std::vector<size_t>{tile_params.size()}, tile_params);
|
||||
auto tile = std::make_shared<ov::op::v0::Tile>(param, repeats);
|
||||
function = std::make_shared<ov::Model>(tile->outputs(), ov::ParameterVector{param}, "tile");
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
||||
@@ -51,7 +51,7 @@ void TopKLayerTest::SetUp() {
|
||||
auto param = std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes.front());
|
||||
auto k = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{}, &keepK);
|
||||
auto topk = std::make_shared<ov::op::v1::TopK>(param, k, axis, mode, sort);
|
||||
function = std::make_shared<ngraph::Function>(topk->outputs(), ov::ParameterVector{param}, "TopK");
|
||||
function = std::make_shared<ov::Model>(topk->outputs(), ov::ParameterVector{param}, "TopK");
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
||||
@@ -46,9 +46,9 @@ void VariadicSplitLayerTest::SetUp() {
|
||||
|
||||
auto param = std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes.front());
|
||||
auto split_axis_const =
|
||||
std::make_shared<ov::op::v0::Constant>(element::i64, ngraph::Shape{}, std::vector<int64_t>{axis});
|
||||
std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{}, std::vector<int64_t>{axis});
|
||||
auto num_split_const =
|
||||
std::make_shared<ov::op::v0::Constant>(element::u64, ngraph::Shape{num_splits.size()}, num_splits);
|
||||
std::make_shared<ov::op::v0::Constant>(ov::element::u64, ov::Shape{num_splits.size()}, num_splits);
|
||||
auto variadic_split = std::make_shared<ov::op::v1::VariadicSplit>(param, split_axis_const, num_split_const);
|
||||
function = std::make_shared<ov::Model>(variadic_split->outputs(), ov::ParameterVector{param}, "VariadicSplit");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user