Refactor EmbeddingBagOffsetsSumLayerTest, EmbeddingBagPackedSumLayerTest, EmbeddingSegmentsSumLayerTest (#19952)
* Refactor EmbeddingBagOffsetsSumLayerTest * Refactor EmbeddingBagPackedSumLayerTest * Refactor EmbeddingSegmentsSumLayerTest
This commit is contained in:
parent
26d18c924b
commit
c1271d1217
@ -4,25 +4,28 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "single_layer_tests/embedding_bag_offsets_sum.hpp"
|
||||
#include "single_op_tests/embedding_bag_offsets_sum.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
|
||||
using namespace LayerTestsDefinitions;
|
||||
|
||||
namespace {
|
||||
using ov::test::EmbeddingBagOffsetsSumLayerTest;
|
||||
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::I32,
|
||||
InferenceEngine::Precision::U8
|
||||
const std::vector<ov::element::Type> model_type = {
|
||||
ov::element::f32,
|
||||
ov::element::i32,
|
||||
ov::element::u8
|
||||
};
|
||||
|
||||
const std::vector<InferenceEngine::Precision> indPrecisions = {
|
||||
InferenceEngine::Precision::I64,
|
||||
InferenceEngine::Precision::I32
|
||||
const std::vector<ov::element::Type> ind_type = {
|
||||
ov::element::i64,
|
||||
ov::element::i32
|
||||
};
|
||||
|
||||
const std::vector<std::vector<size_t>> emb_table_shape = {{5, 6}, {10, 35}, {5, 4, 16}};
|
||||
const std::vector<std::vector<ov::Shape>> input_shapes_static = {
|
||||
{{5, 6}},
|
||||
{{10, 35}},
|
||||
{{5, 4, 16}}};
|
||||
|
||||
const std::vector<std::vector<size_t>> indices =
|
||||
{{0, 1, 2, 2, 3}, {4, 4, 3, 1, 0}, {1, 2, 1, 2, 1, 2, 1, 2, 1, 2}};
|
||||
const std::vector<std::vector<size_t>> offsets = {{0, 2}, {0, 0, 2, 2}, {2, 4}};
|
||||
@ -31,7 +34,6 @@ const std::vector<bool> with_weights = {false, true};
|
||||
const std::vector<bool> with_default_index = {false, true};
|
||||
|
||||
const auto embBagOffsetSumArgSet = ::testing::Combine(
|
||||
::testing::ValuesIn(emb_table_shape),
|
||||
::testing::ValuesIn(indices),
|
||||
::testing::ValuesIn(offsets),
|
||||
::testing::ValuesIn(default_index),
|
||||
@ -42,8 +44,9 @@ const auto embBagOffsetSumArgSet = ::testing::Combine(
|
||||
INSTANTIATE_TEST_SUITE_P(smoke, EmbeddingBagOffsetsSumLayerTest,
|
||||
::testing::Combine(
|
||||
embBagOffsetSumArgSet,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::ValuesIn(indPrecisions),
|
||||
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
|
||||
::testing::ValuesIn(model_type),
|
||||
::testing::ValuesIn(ind_type),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
||||
EmbeddingBagOffsetsSumLayerTest::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -4,31 +4,33 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "single_layer_tests/embedding_bag_packed_sum.hpp"
|
||||
#include "single_op_tests/embedding_bag_packed_sum.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
|
||||
using namespace LayerTestsDefinitions;
|
||||
|
||||
namespace {
|
||||
using ov::test::EmbeddingBagPackedSumLayerTest;
|
||||
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::I32,
|
||||
InferenceEngine::Precision::U8
|
||||
const std::vector<ov::element::Type> model_type = {
|
||||
ov::element::f32,
|
||||
ov::element::i32,
|
||||
ov::element::u8
|
||||
};
|
||||
|
||||
const std::vector<InferenceEngine::Precision> indPrecisions = {
|
||||
InferenceEngine::Precision::I64,
|
||||
InferenceEngine::Precision::I32
|
||||
const std::vector<ov::element::Type> ind_type = {
|
||||
ov::element::i64,
|
||||
ov::element::i32
|
||||
};
|
||||
|
||||
const std::vector<std::vector<size_t>> emb_table_shape = {{5, 6}, {10, 35}, {5, 4, 16}};
|
||||
const std::vector<std::vector<ov::Shape>> input_shapes_static =
|
||||
{{{5, 6}},
|
||||
{{10, 35}},
|
||||
{{5, 4, 16}}};
|
||||
|
||||
const std::vector<std::vector<std::vector<size_t>>> indices =
|
||||
{{{0, 1}, {2, 2}, {3, 4}}, {{4, 4, 3}, {1, 0, 2}}, {{1, 2, 1, 2}, {1, 2, 1, 2}}};
|
||||
const std::vector<bool> with_weights = {false, true};
|
||||
|
||||
const auto embBagPackedSumArgSet = ::testing::Combine(
|
||||
::testing::ValuesIn(emb_table_shape),
|
||||
::testing::ValuesIn(indices),
|
||||
::testing::ValuesIn(with_weights)
|
||||
);
|
||||
@ -36,8 +38,9 @@ const auto embBagPackedSumArgSet = ::testing::Combine(
|
||||
INSTANTIATE_TEST_SUITE_P(smoke, EmbeddingBagPackedSumLayerTest,
|
||||
::testing::Combine(
|
||||
embBagPackedSumArgSet,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::ValuesIn(indPrecisions),
|
||||
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
|
||||
::testing::ValuesIn(model_type),
|
||||
::testing::ValuesIn(ind_type),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
||||
EmbeddingBagPackedSumLayerTest::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -4,27 +4,29 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "single_layer_tests/embedding_segments_sum.hpp"
|
||||
#include "single_op_tests/embedding_segments_sum.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
|
||||
using namespace LayerTestsDefinitions;
|
||||
|
||||
namespace {
|
||||
using ov::test::EmbeddingSegmentsSumLayerTest;
|
||||
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::I32,
|
||||
InferenceEngine::Precision::U8
|
||||
const std::vector<ov::element::Type> model_type = {
|
||||
ov::element::f32,
|
||||
ov::element::i32,
|
||||
ov::element::u8
|
||||
};
|
||||
|
||||
const std::vector<InferenceEngine::Precision> indPrecisions = {
|
||||
InferenceEngine::Precision::I64,
|
||||
InferenceEngine::Precision::I32
|
||||
const std::vector<ov::element::Type> ind_type = {
|
||||
ov::element::i64,
|
||||
ov::element::i32
|
||||
};
|
||||
|
||||
const std::vector<std::vector<size_t>> emb_table_shape = {{5, 6}, {10, 35}, {5, 4, 16}};
|
||||
const std::vector<std::vector<size_t>> indices =
|
||||
{{0, 1, 2, 2, 3}, {4, 4, 3, 1, 2}};
|
||||
const std::vector<std::vector<ov::Shape>> input_shapes_static =
|
||||
{{{5, 6}},
|
||||
{{10, 35}},
|
||||
{{5, 4, 16}}};
|
||||
|
||||
const std::vector<std::vector<size_t>> indices = {{0, 1, 2, 2, 3}, {4, 4, 3, 1, 2}};
|
||||
const std::vector<std::vector<size_t>> segment_ids = {{0, 1, 2, 3, 4}, {0, 0, 2, 2, 4}};
|
||||
const std::vector<size_t> num_segments = {5, 7};
|
||||
const std::vector<size_t> default_index = {0, 4};
|
||||
@ -32,7 +34,6 @@ const std::vector<bool> with_weights = {false, true};
|
||||
const std::vector<bool> with_default_index = {false, true};
|
||||
|
||||
const auto embSegmentsSumArgSet = ::testing::Combine(
|
||||
::testing::ValuesIn(emb_table_shape),
|
||||
::testing::ValuesIn(indices),
|
||||
::testing::ValuesIn(segment_ids),
|
||||
::testing::ValuesIn(num_segments),
|
||||
@ -44,8 +45,9 @@ const auto embSegmentsSumArgSet = ::testing::Combine(
|
||||
INSTANTIATE_TEST_SUITE_P(smoke, EmbeddingSegmentsSumLayerTest,
|
||||
::testing::Combine(
|
||||
embSegmentsSumArgSet,
|
||||
::testing::ValuesIn(netPrecisions),
|
||||
::testing::ValuesIn(indPrecisions),
|
||||
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shapes_static)),
|
||||
::testing::ValuesIn(model_type),
|
||||
::testing::ValuesIn(ind_type),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
||||
EmbeddingSegmentsSumLayerTest::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared_test_classes/single_op/embedding_bag_offsets_sum.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
TEST_P(EmbeddingBagOffsetsSumLayerTest, 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/embedding_bag_packed_sum.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
TEST_P(EmbeddingBagPackedSumLayerTest, 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/embedding_segments_sum.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
TEST_P(EmbeddingSegmentsSumLayerTest, Inference) {
|
||||
run();
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,39 @@
|
||||
// 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<
|
||||
std::vector<size_t>, // indices
|
||||
std::vector<size_t>, // offsets
|
||||
size_t, // default_index
|
||||
bool, // with_weights
|
||||
bool // with_def_index
|
||||
> embeddingBagOffsetsSumParams;
|
||||
|
||||
typedef std::tuple<
|
||||
embeddingBagOffsetsSumParams,
|
||||
std::vector<InputShape>, // shapes
|
||||
ov::element::Type, // model type
|
||||
ov::element::Type, // indices type
|
||||
std::string> embeddingBagOffsetsSumLayerTestParamsSet;
|
||||
|
||||
class EmbeddingBagOffsetsSumLayerTest : public testing::WithParamInterface<embeddingBagOffsetsSumLayerTestParamsSet>,
|
||||
virtual public ov::test::SubgraphBaseTest {
|
||||
public:
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<embeddingBagOffsetsSumLayerTestParamsSet>& obj);
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
};
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,36 @@
|
||||
// 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<
|
||||
std::vector<std::vector<size_t>>, // indices
|
||||
bool // with_weights
|
||||
> embeddingBagPackedSumParams;
|
||||
|
||||
typedef std::tuple<
|
||||
embeddingBagPackedSumParams,
|
||||
std::vector<InputShape>, // input shapes
|
||||
ov::element::Type, // embedding table
|
||||
ov::element::Type, // indices
|
||||
std::string> embeddingBagPackedSumLayerTestParamsSet;
|
||||
|
||||
class EmbeddingBagPackedSumLayerTest : public testing::WithParamInterface<embeddingBagPackedSumLayerTestParamsSet>,
|
||||
virtual public ov::test::SubgraphBaseTest {
|
||||
public:
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<embeddingBagPackedSumLayerTestParamsSet>& obj);
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
};
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,40 @@
|
||||
// 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<
|
||||
std::vector<size_t>, // indices
|
||||
std::vector<size_t>, // segment_ids
|
||||
size_t, // num_segments
|
||||
size_t, // default_index
|
||||
bool, // with_weights
|
||||
bool // with_def_index
|
||||
> embeddingSegmentsSumParams;
|
||||
|
||||
typedef std::tuple<
|
||||
embeddingSegmentsSumParams,
|
||||
std::vector<InputShape>, // input shapes
|
||||
ov::element::Type, // embedding table
|
||||
ov::element::Type, // indices
|
||||
std::string> embeddingSegmentsSumLayerTestParamsSet;
|
||||
|
||||
class EmbeddingSegmentsSumLayerTest : public testing::WithParamInterface<embeddingSegmentsSumLayerTestParamsSet>,
|
||||
virtual public ov::test::SubgraphBaseTest {
|
||||
public:
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<embeddingSegmentsSumLayerTestParamsSet>& obj);
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
};
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,65 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_op/embedding_bag_offsets_sum.hpp"
|
||||
#include "ngraph_functions/builders.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
std::string EmbeddingBagOffsetsSumLayerTest::getTestCaseName(const testing::TestParamInfo<embeddingBagOffsetsSumLayerTestParamsSet>& obj) {
|
||||
embeddingBagOffsetsSumParams emb_params;
|
||||
ov::element::Type model_type, ind_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::string target_device;
|
||||
std::tie(emb_params, shapes, model_type, ind_type, target_device) = obj.param;
|
||||
std::vector<size_t> indices, offsets;
|
||||
size_t default_index;
|
||||
bool with_weights, with_def_index;
|
||||
std::tie(indices, offsets, default_index, with_weights, with_def_index) = emb_params;
|
||||
|
||||
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 << "I" << ov::test::utils::vec2str(indices) << "_";
|
||||
result << "O" << ov::test::utils::vec2str(offsets) << "_";
|
||||
result << "DI" << default_index << "_";
|
||||
result << "WW" << with_weights << "_";
|
||||
result << "WDI" << with_def_index << "_";
|
||||
result << "netPRC=" << model_type.get_type_name() << "_";
|
||||
result << "indPRC=" << ind_type.get_type_name() << "_";
|
||||
result << "targetDevice=" << target_device;
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void EmbeddingBagOffsetsSumLayerTest::SetUp() {
|
||||
embeddingBagOffsetsSumParams emb_params;
|
||||
ov::element::Type model_type, ind_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::tie(emb_params, shapes, model_type, ind_type, targetDevice) = this->GetParam();
|
||||
init_input_shapes(shapes);
|
||||
|
||||
std::vector<size_t> indices, offsets;
|
||||
bool with_weights, with_def_index;
|
||||
size_t default_index;
|
||||
std::tie(indices, offsets, default_index, with_weights, with_def_index) = emb_params;
|
||||
|
||||
auto param = std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes.front());
|
||||
|
||||
auto embBag = ngraph::builder::makeEmbeddingBagOffsetsSum(model_type, ind_type, param, indices, offsets, default_index, with_weights, with_def_index);
|
||||
|
||||
auto result = std::make_shared<ov::op::v0::Result>(embBag);
|
||||
function = std::make_shared<ov::Model>(result, ov::ParameterVector{param}, "embeddingBagOffsetsSum");
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,59 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_op/embedding_bag_packed_sum.hpp"
|
||||
#include "ngraph_functions/builders.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
std::string EmbeddingBagPackedSumLayerTest::getTestCaseName(const testing::TestParamInfo<embeddingBagPackedSumLayerTestParamsSet>& obj) {
|
||||
embeddingBagPackedSumParams emb_params;
|
||||
ov::element::Type model_type, ind_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::string target_device;
|
||||
std::tie(emb_params, shapes, model_type, ind_type, target_device) = obj.param;
|
||||
std::vector<std::vector<size_t>> indices;
|
||||
bool with_weights;
|
||||
std::tie(indices, with_weights) = emb_params;
|
||||
|
||||
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 << "I" << ov::test::utils::vec2str(indices) << "_";
|
||||
result << "WW" << with_weights << "_";
|
||||
result << "netPRC=" << model_type.get_type_name() << "_";
|
||||
result << "indPRC=" << ind_type.get_type_name() << "_";
|
||||
result << "targetDevice=" << target_device;
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void EmbeddingBagPackedSumLayerTest::SetUp() {
|
||||
embeddingBagPackedSumParams emb_params;
|
||||
ov::element::Type model_type, ind_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::tie(emb_params, shapes, model_type, ind_type, targetDevice) = this->GetParam();
|
||||
std::vector<std::vector<size_t>> indices;
|
||||
bool with_weights;
|
||||
std::tie(indices, with_weights) = emb_params;
|
||||
init_input_shapes(shapes);
|
||||
|
||||
auto param = std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes.front());
|
||||
|
||||
auto embBag = ngraph::builder::makeEmbeddingBagPackedSum(model_type, ind_type, param, indices, with_weights);
|
||||
|
||||
auto result = std::make_shared<ov::op::v0::Result>(embBag);
|
||||
function = std::make_shared<ov::Model>(result, ov::ParameterVector{param}, "embeddingBagPackedSum");
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,76 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_op/embedding_segments_sum.hpp"
|
||||
#include "ngraph_functions/builders.hpp"
|
||||
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
|
||||
std::string EmbeddingSegmentsSumLayerTest::getTestCaseName(const testing::TestParamInfo<embeddingSegmentsSumLayerTestParamsSet>& obj) {
|
||||
embeddingSegmentsSumParams params;
|
||||
ov::element::Type model_type, ind_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::string target_device;
|
||||
std::tie(params, shapes, model_type, ind_type, target_device) = obj.param;
|
||||
std::vector<size_t> indices, segment_ids;
|
||||
size_t num_segments, default_index;
|
||||
bool with_weights, with_def_index;
|
||||
std::tie(indices, segment_ids, num_segments, default_index, with_weights, with_def_index) = params;
|
||||
|
||||
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 << "I" << ov::test::utils::vec2str(indices) << "_";
|
||||
result << "SI" << ov::test::utils::vec2str(segment_ids) << "_";
|
||||
result << "NS" << num_segments << "_";
|
||||
result << "DI" << default_index << "_";
|
||||
result << "WW" << with_weights << "_";
|
||||
result << "WDI" << with_def_index << "_";
|
||||
result << "netPRC=" << model_type.get_type_name() << "_";
|
||||
result << "indPRC=" << ind_type.get_type_name() << "_";
|
||||
result << "targetDevice=" << target_device;
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void EmbeddingSegmentsSumLayerTest::SetUp() {
|
||||
embeddingSegmentsSumParams embParams;
|
||||
ov::element::Type model_type, ind_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::tie(embParams, shapes, model_type, ind_type, targetDevice) = this->GetParam();
|
||||
init_input_shapes(shapes);
|
||||
|
||||
std::vector<size_t> indices, segment_ids;
|
||||
bool with_weights, with_def_index;
|
||||
size_t num_segments, default_index;
|
||||
std::tie(indices, segment_ids, num_segments, default_index, with_weights, with_def_index) = embParams;
|
||||
|
||||
auto param = std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes.front());
|
||||
|
||||
auto embBag = ngraph::builder::makeEmbeddingSegmentsSum(model_type,
|
||||
ind_type,
|
||||
param,
|
||||
indices,
|
||||
segment_ids,
|
||||
num_segments,
|
||||
default_index,
|
||||
with_weights,
|
||||
with_def_index);
|
||||
|
||||
auto result = std::make_shared<ov::op::v0::Result>(embBag);
|
||||
function = std::make_shared<ov::Model>(result, ov::ParameterVector{param}, "embeddingSegmentsSum");
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
Loading…
Reference in New Issue
Block a user