From d2c1c5f92b8c5b67bd6b5882454f8c79c9842f28 Mon Sep 17 00:00:00 2001 From: Tomasz Jankowski Date: Fri, 5 Apr 2024 07:33:29 +0200 Subject: [PATCH] [Tmpl test] Clamp: enable whole Tensor comparison (#23770) ### Details: - Used actual shapes for Tensors creation. ### Tickets: - CVS-137149 --------- Co-authored-by: Michal Lukaszewski --- .../tests/functional/op_reference/clamp.cpp | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/plugins/template/tests/functional/op_reference/clamp.cpp b/src/plugins/template/tests/functional/op_reference/clamp.cpp index 732f54e2284..71c8055e3da 100644 --- a/src/plugins/template/tests/functional/op_reference/clamp.cpp +++ b/src/plugins/template/tests/functional/op_reference/clamp.cpp @@ -14,7 +14,7 @@ using namespace ov; namespace { struct ClampParams { template - ClampParams(const ov::PartialShape& shape, + ClampParams(const ov::Shape& shape, const ov::element::Type& iType, const std::vector& iValues, const std::vector& oValues, @@ -22,16 +22,16 @@ struct ClampParams { const double max) : min(min), max(max), - pshape(shape), + shape(shape), inType(iType), outType(iType), - inputData(CreateTensor(iType, iValues)), - refData(CreateTensor(iType, oValues)) {} + inputData(CreateTensor(shape, iType, iValues)), + refData(CreateTensor(shape, iType, oValues)) {} double min = 0; double max = 0; - ov::PartialShape pshape; + ov::Shape shape; ov::element::Type inType; ov::element::Type outType; ov::Tensor inputData; @@ -41,16 +41,15 @@ struct ClampParams { class ReferenceClampLayerTest : public testing::TestWithParam, public CommonReferenceTest { public: void SetUp() override { - legacy_compare = true; - auto params = GetParam(); - function = CreateFunction(params.pshape, params.inType, params.outType, params.min, params.max); + const auto& params = GetParam(); + function = CreateFunction(params.shape, params.inType, params.outType, params.min, params.max); inputData = {params.inputData}; refOutData = {params.refData}; } static std::string getTestCaseName(const testing::TestParamInfo& obj) { - auto param = obj.param; + const auto& param = obj.param; std::ostringstream result; - result << "shape=" << param.pshape << "_"; + result << "shape=" << param.shape << "_"; result << "iType=" << param.inType << "_"; result << "oType=" << param.outType << "_"; result << "min=" << param.min << "_"; @@ -59,7 +58,7 @@ public: } private: - static std::shared_ptr CreateFunction(const ov::PartialShape& input_shape, + static std::shared_ptr CreateFunction(const ov::Shape& input_shape, const ov::element::Type& input_type, const ov::element::Type& expected_output_type, const double min, @@ -82,25 +81,25 @@ std::vector generateClampFloatParams() { auto pinf = std::numeric_limits::infinity(); auto ninf = -std::numeric_limits::infinity(); std::vector clampParams{ - ClampParams(ov::PartialShape{5, 2}, + ClampParams(ov::Shape{5, 2}, IN_ET, std::vector{-0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8}, std::vector{0.2, 0.2, 0.2, 0.2, 0.3, 0.4, 0.5, 0.6, 0.6, 0.6}, 0.2, 0.6), - ClampParams(ov::PartialShape{5, 2}, + ClampParams(ov::Shape{5, 2}, IN_ET, std::vector{min, max, ninf, pinf, 9.99999, 10.0, 10.000001, 19.999999, 20.0, 20.000001}, std::vector{10.0, 20.0, 10.0, 20.0, 10.0, 10.0, 10.000001, 19.999999, 20.0, 20.0}, 10.0, 20.0), - ClampParams(ov::PartialShape{5, 2}, + ClampParams(ov::Shape{5, 2}, IN_ET, std::vector{min, max, ninf, pinf, 9.99999, 10.0, 10.000001, 19.999999, 20.0, 20.000001}, std::vector{10.0, max, 10.0, pinf, 10.0, 10.0, 10.000001, 19.999999, 20.0, 20.000001}, 10.0, pinf), - ClampParams(ov::PartialShape{5, 2}, + ClampParams(ov::Shape{5, 2}, IN_ET, std::vector{min, max, ninf, pinf, 9.99999, 10.0, 10.000001, 19.999999, 20.0, 20.000001}, std::vector{min, 20.0, ninf, 20.0, 9.99999, 10.0, 10.000001, 19.999999, 20.0, 20.0}, @@ -116,31 +115,31 @@ std::vector generateClampIntParams() { auto max = std::numeric_limits::max(); auto pinf = std::numeric_limits::infinity(); auto ninf = -std::numeric_limits::infinity(); - std::vector clampParams{ClampParams(ov::PartialShape{6}, + std::vector clampParams{ClampParams(ov::Shape{6}, IN_ET, std::vector{-1, 3, -10, 20, 6, 2}, std::vector{1, 3, 1, 5, 5, 2}, 0.4, 5.6), - ClampParams(ov::PartialShape{6}, + ClampParams(ov::Shape{6}, IN_ET, std::vector{-6, 1, -2, 0, -1, 2}, std::vector{-5, -1, -2, -1, -1, -1}, -5.6, -0.4), - ClampParams(ov::PartialShape{4, 2}, + ClampParams(ov::Shape{4, 2}, IN_ET, std::vector{min, max, 9, 10, 11, 19, 20, 21}, std::vector{10, 20, 10, 10, 11, 19, 20, 20}, 10.0, 20.0), - ClampParams(ov::PartialShape{4, 2}, + ClampParams(ov::Shape{4, 2}, IN_ET, std::vector{min, max, 9, 10, 11, 19, 20, 21}, std::vector{10, max, 10, 10, 11, 19, 20, 21}, 10.0, pinf), - ClampParams(ov::PartialShape{4, 2}, + ClampParams(ov::Shape{4, 2}, IN_ET, std::vector{min, max, 9, 10, 11, 19, 20, 21}, std::vector{min, 20, 9, 10, 11, 19, 20, 20}, @@ -156,19 +155,19 @@ std::vector generateClampUintParams() { T max = (static_cast(1) << (std::numeric_limits::digits - 1)) - 1; auto pinf = static_cast(max); auto ninf = -std::numeric_limits::infinity(); - std::vector clampParams{ClampParams(ov::PartialShape{4, 2}, + std::vector clampParams{ClampParams(ov::Shape{4, 2}, IN_ET, std::vector{min, max, 9, 10, 11, 19, 20, 21}, std::vector{10, 20, 10, 10, 11, 19, 20, 20}, 10.0, 20.0), - ClampParams(ov::PartialShape{4, 2}, + ClampParams(ov::Shape{4, 2}, IN_ET, std::vector{min, max, 9, 10, 11, 19, 20, 21}, std::vector{10, max, 10, 10, 11, 19, 20, 21}, 10.0, pinf), - ClampParams(ov::PartialShape{4, 2}, + ClampParams(ov::Shape{4, 2}, IN_ET, std::vector{min, max, 9, 10, 11, 19, 20, 21}, std::vector{min, 20, 9, 10, 11, 19, 20, 20},