Refactor PowerLayerTest, PriorBoxClusteredLayerTest, PriorBoxLayerTest (#20349)
* Refactor PowerLayerTest * Refactor PriorBoxClusteredLayerTest * Refactor PriorBoxLayerTest
This commit is contained in:
parent
0a0d0f0aa5
commit
c61fce428e
@ -4,14 +4,16 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "single_layer_tests/prior_box.hpp"
|
||||
#include "single_op_tests/prior_box.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
|
||||
using namespace LayerTestsDefinitions;
|
||||
namespace {
|
||||
using ov::test::PriorBoxLayerTest;
|
||||
|
||||
const std::vector<ov::element::Type> model_types = {
|
||||
ov::element::i32,
|
||||
ov::element::u16};
|
||||
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
InferenceEngine::Precision::I32,
|
||||
InferenceEngine::Precision::U16};
|
||||
const std::vector<std::vector<float>> min_sizes = {
|
||||
{256.0f}};
|
||||
|
||||
@ -53,8 +55,7 @@ const std::vector<bool> scale_all_sizes = {
|
||||
const std::vector<bool> min_max_aspect_ratios_order = {
|
||||
false, true};
|
||||
|
||||
const std::vector<size_t> inputShape = {300, 300};
|
||||
const std::vector<size_t> imageShape = {32, 32};
|
||||
const std::vector<ov::Shape> input_shapes_static = {{300, 300}, {32, 32}};
|
||||
|
||||
const auto layerSpecificParams = ::testing::Combine(
|
||||
::testing::ValuesIn(min_sizes),
|
||||
@ -74,12 +75,8 @@ const auto layerSpecificParams = ::testing::Combine(
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_PriorBox_Basic, PriorBoxLayerTest,
|
||||
::testing::Combine(
|
||||
layerSpecificParams,
|
||||
::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(inputShape),
|
||||
::testing::Values(imageShape),
|
||||
::testing::ValuesIn(model_types),
|
||||
::testing::Values(ov::test::static_shapes_to_test_representation(input_shapes_static)),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
||||
PriorBoxLayerTest::getTestCaseName);
|
||||
} // namespace
|
||||
|
@ -3,17 +3,15 @@
|
||||
//
|
||||
|
||||
#include <vector>
|
||||
#include "single_layer_tests/prior_box_clustered.hpp"
|
||||
#include "single_op_tests/prior_box_clustered.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
|
||||
using namespace LayerTestsDefinitions;
|
||||
using namespace ngraph::helpers;
|
||||
|
||||
namespace {
|
||||
using ov::test::PriorBoxClusteredLayerTest;
|
||||
// Common params
|
||||
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
|
||||
};
|
||||
|
||||
const std::vector<std::vector<float>> widths = {
|
||||
@ -63,18 +61,14 @@ const auto layerSpeficParams = ::testing::Combine(
|
||||
::testing::ValuesIn(variances)
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_PriorBoxClustered_Basic, PriorBoxClusteredLayerTest,
|
||||
::testing::Combine(
|
||||
layerSpeficParams,
|
||||
::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>({ 4, 4 })),
|
||||
::testing::Values(std::vector<size_t>({ 50, 50 })),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
||||
PriorBoxClusteredLayerTest::getTestCaseName
|
||||
);
|
||||
std::vector<ov::Shape> input_shapes_static = {{4, 4}, {50, 50}};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_PriorBoxClustered_Basic, PriorBoxClusteredLayerTest,
|
||||
::testing::Combine(
|
||||
layerSpeficParams,
|
||||
::testing::ValuesIn(model_types),
|
||||
::testing::Values(ov::test::static_shapes_to_test_representation(input_shapes_static)),
|
||||
::testing::Values(ov::test::utils::DEVICE_CPU)),
|
||||
PriorBoxClusteredLayerTest::getTestCaseName
|
||||
);
|
||||
} // namespace
|
||||
|
@ -2,47 +2,42 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <vector>
|
||||
#include "single_layer_tests/power.hpp"
|
||||
#include "single_op_tests/power.hpp"
|
||||
#include "common_test_utils/test_constants.hpp"
|
||||
|
||||
using namespace LayerTestsDefinitions;
|
||||
|
||||
namespace {
|
||||
using ov::test::PowerLayerTest;
|
||||
|
||||
std::vector<std::vector<std::vector<size_t>>> inShapes = {
|
||||
{{1, 8}},
|
||||
{{2, 16}},
|
||||
{{3, 32}},
|
||||
{{4, 64}},
|
||||
{{5, 128}},
|
||||
{{6, 256}},
|
||||
{{7, 512}},
|
||||
{{8, 1024}}
|
||||
};
|
||||
std::vector<std::vector<ov::Shape>> input_shape_static = {
|
||||
{{1, 8}},
|
||||
{{2, 16}},
|
||||
{{3, 32}},
|
||||
{{4, 64}},
|
||||
{{5, 128}},
|
||||
{{6, 256}},
|
||||
{{7, 512}},
|
||||
{{8, 1024}}
|
||||
};
|
||||
|
||||
std::vector<std::vector<float >> Power = {
|
||||
{0.0f},
|
||||
{0.5f},
|
||||
{1.0f},
|
||||
{1.1f},
|
||||
{1.5f},
|
||||
{2.0f},
|
||||
};
|
||||
std::vector<std::vector<float>> powers = {
|
||||
{0.0f},
|
||||
{0.5f},
|
||||
{1.0f},
|
||||
{1.1f},
|
||||
{1.5f},
|
||||
{2.0f},
|
||||
};
|
||||
|
||||
std::vector<InferenceEngine::Precision> netPrecisions = {InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::FP16,
|
||||
};
|
||||
std::vector<ov::element::Type> model_types = {
|
||||
ov::element::f32,
|
||||
ov::element::f16,
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_power, PowerLayerTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(inShapes),
|
||||
::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(ov::test::utils::DEVICE_GPU),
|
||||
::testing::ValuesIn(Power)),
|
||||
PowerLayerTest::getTestCaseName);
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_power, PowerLayerTest,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(ov::test::static_shapes_to_test_representation(input_shape_static)),
|
||||
::testing::ValuesIn(model_types),
|
||||
::testing::ValuesIn(powers),
|
||||
::testing::Values(ov::test::utils::DEVICE_GPU)),
|
||||
PowerLayerTest::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/power.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
TEST_P(PowerLayerTest, 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/prior_box.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
TEST_P(PriorBoxLayerTest, 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/prior_box_clustered.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
TEST_P(PriorBoxClusteredLayerTest, Inference) {
|
||||
run();
|
||||
};
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,30 @@
|
||||
// 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 PowerParamsTuple = typename std::tuple<
|
||||
std::vector<InputShape>, // Input shapes
|
||||
ov::element::Type, // Model type
|
||||
std::vector<float>, // Power
|
||||
std::string>; // Device name
|
||||
|
||||
class PowerLayerTest:
|
||||
public testing::WithParamInterface<PowerParamsTuple>,
|
||||
virtual public ov::test::SubgraphBaseTest{
|
||||
public:
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<PowerParamsTuple> &obj);
|
||||
protected:
|
||||
void SetUp() override;
|
||||
};
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,46 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <tuple>
|
||||
#include <string>
|
||||
|
||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
using priorBoxSpecificParams = std::tuple<
|
||||
std::vector<float>, // min_size
|
||||
std::vector<float>, // max_size
|
||||
std::vector<float>, // aspect_ratio
|
||||
std::vector<float>, // density
|
||||
std::vector<float>, // fixed_ratio
|
||||
std::vector<float>, // fixed_size
|
||||
bool, // clip
|
||||
bool, // flip
|
||||
float, // step
|
||||
float, // offset
|
||||
std::vector<float>, // variance
|
||||
bool, // scale_all_sizes
|
||||
bool>; // min_max_aspect_ratios_order
|
||||
|
||||
typedef std::tuple<
|
||||
priorBoxSpecificParams,
|
||||
ov::element::Type, // model type
|
||||
std::vector<InputShape>, // input shape
|
||||
std::string> priorBoxLayerParams;
|
||||
|
||||
class PriorBoxLayerTest
|
||||
: public testing::WithParamInterface<priorBoxLayerParams>,
|
||||
virtual public ov::test::SubgraphBaseStaticTest {
|
||||
public:
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<priorBoxLayerParams>& 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 <vector>
|
||||
#include <tuple>
|
||||
#include <string>
|
||||
|
||||
#include "shared_test_classes/base/ov_subgraph.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
typedef std::tuple<
|
||||
std::vector<float>, // widths
|
||||
std::vector<float>, // heights
|
||||
bool, // clip
|
||||
float, // step_width
|
||||
float, // step_height
|
||||
float, // step
|
||||
float, // offset
|
||||
std::vector<float>> priorBoxClusteredSpecificParams;
|
||||
|
||||
typedef std::tuple<
|
||||
priorBoxClusteredSpecificParams,
|
||||
ov::element::Type, // Model type
|
||||
std::vector<InputShape>, // Input shape
|
||||
std::string> priorBoxClusteredLayerParams;
|
||||
|
||||
class PriorBoxClusteredLayerTest : public testing::WithParamInterface<priorBoxClusteredLayerParams>,
|
||||
virtual public ov::test::SubgraphBaseTest {
|
||||
public:
|
||||
static std::string getTestCaseName(const testing::TestParamInfo<priorBoxClusteredLayerParams>& obj);
|
||||
|
||||
protected:
|
||||
void SetUp() override;
|
||||
};
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,57 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_op/power.hpp"
|
||||
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/result.hpp"
|
||||
#include "openvino/op/power.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
std::string PowerLayerTest::getTestCaseName(const testing::TestParamInfo<PowerParamsTuple> &obj) {
|
||||
std::vector<InputShape> shapes;
|
||||
ov::element::Type model_type;
|
||||
std::string device_name;
|
||||
std::vector<float> power;
|
||||
std::tie(shapes, model_type, power, device_name) = 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 << "Power=" << ov::test::utils::vec2str(power) << "_";
|
||||
result << "netPRC=" << model_type.get_type_name() << "_";
|
||||
result << "trgDev=" << device_name << "_";
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void PowerLayerTest::SetUp() {
|
||||
abs_threshold = 0.04f;
|
||||
|
||||
std::vector<InputShape> shapes;
|
||||
ov::element::Type model_type;
|
||||
std::vector<float> power;
|
||||
std::tie(shapes, model_type, power, targetDevice) = this->GetParam();
|
||||
init_input_shapes(shapes);
|
||||
|
||||
auto param = std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes.front());
|
||||
|
||||
auto power_const = std::make_shared<ov::op::v0::Constant>(model_type, ngraph::Shape{1}, power);
|
||||
auto pow = std::make_shared<ov::op::v1::Power>(param, power_const);
|
||||
|
||||
function = std::make_shared<ov::Model>(pow, ov::ParameterVector{param}, "power");
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,117 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_op/prior_box.hpp"
|
||||
|
||||
#include "openvino/pass/constant_folding.hpp"
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/result.hpp"
|
||||
#include "openvino/op/shape_of.hpp"
|
||||
#include "openvino/op/prior_box_clustered.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
std::string PriorBoxLayerTest::getTestCaseName(const testing::TestParamInfo<priorBoxLayerParams>& obj) {
|
||||
ov::element::Type model_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::string target_device;
|
||||
priorBoxSpecificParams spec_params;
|
||||
std::tie(spec_params, model_type, shapes, target_device) = obj.param;
|
||||
|
||||
std::vector<float> min_size, max_size, aspect_ratio, density, fixed_ratio, fixed_size, variance;
|
||||
float step, offset;
|
||||
bool clip, flip, scale_all_sizes, min_max_aspect_ratios_order;
|
||||
std::tie(min_size, max_size, aspect_ratio, density, fixed_ratio, fixed_size, clip,
|
||||
flip, step, offset, variance, scale_all_sizes, min_max_aspect_ratios_order) = spec_params;
|
||||
|
||||
std::ostringstream result;
|
||||
const char separator = '_';
|
||||
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 << "netPRC=" << model_type.get_type_name() << separator;
|
||||
result << "min_s=" << ov::test::utils::vec2str(min_size) << separator;
|
||||
result << "max_s=" << ov::test::utils::vec2str(max_size)<< separator;
|
||||
result << "asp_r=" << ov::test::utils::vec2str(aspect_ratio)<< separator;
|
||||
result << "dens=" << ov::test::utils::vec2str(density)<< separator;
|
||||
result << "fix_r=" << ov::test::utils::vec2str(fixed_ratio)<< separator;
|
||||
result << "fix_s=" << ov::test::utils::vec2str(fixed_size)<< separator;
|
||||
result << "var=" << ov::test::utils::vec2str(variance)<< separator;
|
||||
result << "step=" << step << separator;
|
||||
result << "off=" << offset << separator;
|
||||
result << "clip=" << clip << separator;
|
||||
result << "flip=" << flip<< separator;
|
||||
result << "scale_all=" << scale_all_sizes << separator;
|
||||
result << "min_max_aspect_ratios_order=" << min_max_aspect_ratios_order << separator;
|
||||
result << "trgDev=" << target_device;
|
||||
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void PriorBoxLayerTest::SetUp() {
|
||||
ov::element::Type model_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::vector<float> min_size;
|
||||
std::vector<float> max_size;
|
||||
std::vector<float> aspect_ratio;
|
||||
std::vector<float> density;
|
||||
std::vector<float> fixed_ratio;
|
||||
std::vector<float> fixed_size;
|
||||
std::vector<float> variance;
|
||||
float step;
|
||||
float offset;
|
||||
bool clip;
|
||||
bool flip;
|
||||
bool scale_all_sizes;
|
||||
bool min_max_aspect_ratios_order;
|
||||
|
||||
priorBoxSpecificParams spec_params;
|
||||
std::tie(spec_params, model_type, shapes, targetDevice) = GetParam();
|
||||
|
||||
std::tie(min_size, max_size, aspect_ratio, density, fixed_ratio, fixed_size, clip,
|
||||
flip, step, offset, variance, scale_all_sizes, min_max_aspect_ratios_order) = spec_params;
|
||||
init_input_shapes(shapes);
|
||||
|
||||
ov::ParameterVector params{std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes[0]),
|
||||
std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes[1])};
|
||||
|
||||
ov::op::v8::PriorBox::Attributes attributes;
|
||||
attributes.min_size = min_size;
|
||||
attributes.max_size = max_size;
|
||||
attributes.aspect_ratio = aspect_ratio;
|
||||
attributes.density = density;
|
||||
attributes.fixed_ratio = fixed_ratio;
|
||||
attributes.fixed_size = fixed_size;
|
||||
attributes.variance = variance;
|
||||
attributes.step = step;
|
||||
attributes.offset = offset;
|
||||
attributes.clip = clip;
|
||||
attributes.flip = flip;
|
||||
attributes.scale_all_sizes = scale_all_sizes;
|
||||
attributes.min_max_aspect_ratios_order = min_max_aspect_ratios_order;
|
||||
|
||||
auto shape_of_1 = std::make_shared<ov::op::v3::ShapeOf>(params[0]);
|
||||
auto shape_of_2 = std::make_shared<ov::op::v3::ShapeOf>(params[1]);
|
||||
auto priorBox = std::make_shared<ov::op::v8::PriorBox>(
|
||||
shape_of_1,
|
||||
shape_of_2,
|
||||
attributes);
|
||||
|
||||
ov::pass::disable_constant_folding(priorBox);
|
||||
|
||||
auto result = std::make_shared<ov::op::v0::Result>(priorBox);
|
||||
function = std::make_shared <ov::Model>(result, params, "PriorBoxFunction");
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
@ -0,0 +1,95 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "shared_test_classes/single_op/prior_box_clustered.hpp"
|
||||
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/result.hpp"
|
||||
#include "openvino/op/shape_of.hpp"
|
||||
#include "openvino/op/prior_box_clustered.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace test {
|
||||
std::string PriorBoxClusteredLayerTest::getTestCaseName(const testing::TestParamInfo<priorBoxClusteredLayerParams>& obj) {
|
||||
ov::element::Type model_type;
|
||||
std::vector<InputShape> shapes;
|
||||
std::string target_device;
|
||||
priorBoxClusteredSpecificParams specParams;
|
||||
std::tie(specParams, model_type, shapes, target_device) = obj.param;
|
||||
|
||||
std::vector<float> widths, heights, variances;
|
||||
float step_width, step_height, step, offset;
|
||||
bool clip;
|
||||
std::tie(widths, heights, clip, step_width, step_height, step, offset, variances) = specParams;
|
||||
|
||||
std::ostringstream result;
|
||||
const char separator = '_';
|
||||
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 << "netPRC=" << model_type.get_type_name() << separator;
|
||||
result << "widths=" << ov::test::utils::vec2str(widths) << separator;
|
||||
result << "heights=" << ov::test::utils::vec2str(heights) << separator;
|
||||
result << "variances=";
|
||||
if (variances.empty())
|
||||
result << "()" << separator;
|
||||
else
|
||||
result << ov::test::utils::vec2str(variances) << separator;
|
||||
result << "stepWidth=" << step_width << separator;
|
||||
result << "stepHeight=" << step_height << separator;
|
||||
result << "step=" << step << separator;
|
||||
result << "offset=" << offset << separator;
|
||||
result << "clip=" << std::boolalpha << clip << separator;
|
||||
result << "trgDev=" << target_device;
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void PriorBoxClusteredLayerTest::SetUp() {
|
||||
std::vector<InputShape> shapes;
|
||||
ov::element::Type model_type;
|
||||
std::vector<float> widths;
|
||||
std::vector<float> heights;
|
||||
std::vector<float> variances;
|
||||
float step_width;
|
||||
float step_height;
|
||||
float step;
|
||||
float offset;
|
||||
bool clip;
|
||||
priorBoxClusteredSpecificParams specParams;
|
||||
std::tie(specParams, model_type, shapes, targetDevice) = GetParam();
|
||||
std::tie(widths, heights, clip, step_width, step_height, step, offset, variances) = specParams;
|
||||
init_input_shapes(shapes);
|
||||
|
||||
ov::ParameterVector params{std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes[0]),
|
||||
std::make_shared<ov::op::v0::Parameter>(model_type, inputDynamicShapes[1])};
|
||||
|
||||
ov::op::v0::PriorBoxClustered::Attributes attributes;
|
||||
attributes.widths = widths;
|
||||
attributes.heights = heights;
|
||||
attributes.clip = clip;
|
||||
attributes.step_widths = step_width;
|
||||
attributes.step_heights = step_height;
|
||||
attributes.step = step;
|
||||
attributes.offset = offset;
|
||||
attributes.variances = variances;
|
||||
|
||||
auto shape_of_1 = std::make_shared<ov::op::v3::ShapeOf>(params[0]);
|
||||
auto shape_of_2 = std::make_shared<ov::op::v3::ShapeOf>(params[1]);
|
||||
auto prior_box_clustered = std::make_shared<ov::op::v0::PriorBoxClustered>(shape_of_1, shape_of_2, attributes);
|
||||
|
||||
auto result = std::make_shared<ov::op::v0::Result>(prior_box_clustered);
|
||||
function = std::make_shared<ov::Model>(result, params, "PB_Clustered");
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace ov
|
Loading…
Reference in New Issue
Block a user