From 9387d3a7d482898d3a1a5586b02b53139e6f25f0 Mon Sep 17 00:00:00 2001 From: HU Yuan2 Date: Tue, 8 Aug 2023 12:23:54 +0800 Subject: [PATCH] enable skipped test case of matmul remove some test cases, custom matmul only support some rank Signed-off-by: HU Yuan2 --- .../src/shape_inference/custom/matmul.cpp | 2 +- .../custom_shape_infer/matmul.cpp | 27 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/matmul.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/matmul.cpp index 1484e35b179..032c09d7b90 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/matmul.cpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/matmul.cpp @@ -29,7 +29,7 @@ Result MMShapeInfer::infer( if (rankA == 1 && rankB == 1 && shapeA[0] == shapeB[0]) { return {{m_shapeY}, ShapeInferStatus::success}; } - + OPENVINO_ASSERT(m_out_rank >= 2); m_shapeY[m_out_rank-2] = m_transpose_a ? shapeA[rankA-1] : shapeA[rankA-2]; m_shapeY[m_out_rank-1] = m_transpose_b ? shapeB[rankB-2] : shapeB[rankB-1]; diff --git a/src/plugins/intel_cpu/tests/unit/shape_inference_test/custom_shape_infer/matmul.cpp b/src/plugins/intel_cpu/tests/unit/shape_inference_test/custom_shape_infer/matmul.cpp index b503b5e965a..f6854a696db 100644 --- a/src/plugins/intel_cpu/tests/unit/shape_inference_test/custom_shape_infer/matmul.cpp +++ b/src/plugins/intel_cpu/tests/unit/shape_inference_test/custom_shape_infer/matmul.cpp @@ -4,6 +4,8 @@ #include #include "custom_shape_infer.hpp" +#include "openvino/core/dimension.hpp" +#include "openvino/core/partial_shape.hpp" #include "openvino/op/ops.hpp" namespace ov { namespace intel_cpu { @@ -33,7 +35,7 @@ public: protected: void SetUp() override { std::tie(a_shape, b_shape) = GetParam(); - + (*exp_shape).clear(); set_exp_shape(); output_shapes.clear(); output_shapes.push_back(exp_shape); @@ -82,39 +84,35 @@ protected: }; TEST_P(CPUMatMulTest, no_input_transpose) { - GTEST_SKIP() << "Skipping test, please check CVS-108946"; const auto matmul = make_matmul(a_shape.size(), b_shape.size(), false, false); std::vector static_input_shapes = {a_shape, b_shape}; - // TODO 108946,below test case can't pass + matmul->set_output_type(0, element::i64, ov::PartialShape(std::vector(exp_shape.size(), -1))); unit_test::cpu_test_shape_infer(matmul.get(), static_input_shapes, output_shapes); } TEST_P(CPUMatMulTest, transpose_input_a) { - GTEST_SKIP() << "Skipping test, please check CVS-108946"; const auto matmul = make_matmul(a_shape.size(), b_shape.size(), true, false); const auto a_transpose = make_transpose_input(a_shape); std::vector static_input_shapes = {a_transpose, b_shape}; - // TODO 108946,below test case can't pass + matmul->set_output_type(0, element::i64, ov::PartialShape(std::vector(exp_shape.size(), -1))); unit_test::cpu_test_shape_infer(matmul.get(), static_input_shapes, output_shapes); } TEST_P(CPUMatMulTest, transpose_input_b) { - GTEST_SKIP() << "Skipping test, please check CVS-108946"; const auto matmul = make_matmul(a_shape.size(), b_shape.size(), false, true); const auto b_transpose = make_transpose_input(b_shape); std::vector static_input_shapes = {a_shape, b_transpose}; - // TODO 108946,below test case can't pass + matmul->set_output_type(0, element::i64, ov::PartialShape(std::vector(exp_shape.size(), -1))); unit_test::cpu_test_shape_infer(matmul.get(), static_input_shapes, output_shapes); } TEST_P(CPUMatMulTest, transpose_inputs_a_b) { - GTEST_SKIP() << "Skipping test, please check CVS-108946"; const auto matmul = make_matmul(a_shape.size(), b_shape.size(), true, true); const auto a_transpose = make_transpose_input(a_shape); @@ -122,23 +120,24 @@ TEST_P(CPUMatMulTest, transpose_inputs_a_b) { std::vector static_input_shapes = {a_transpose, b_transpose}; - // TODO 108946,below test case can't pass + matmul->set_output_type(0, element::i64, ov::PartialShape(std::vector(exp_shape.size(), -1))); unit_test::cpu_test_shape_infer(matmul.get(), static_input_shapes, output_shapes); } /** \brief Use transpose order -> output shape dimensions shall be as transpose order. */ INSTANTIATE_TEST_SUITE_P(CpuShapeInfer, CPUMatMulTest, + // only support rankA = rankB Values(make_tuple(StaticShape({1}), StaticShape({1})), - make_tuple(StaticShape({1}), StaticShape({1, 3})), - make_tuple(StaticShape({1}), StaticShape({1, 1, 3})), - make_tuple(StaticShape({3, 1}), StaticShape({1})), - make_tuple(StaticShape({3, 2, 1}), StaticShape({1})), make_tuple(StaticShape({3}), StaticShape({3})), make_tuple(StaticShape({5, 2}), StaticShape({2, 6})), - make_tuple(StaticShape({2, 1, 2}), StaticShape({2, 6})), make_tuple(StaticShape({10, 8, 9, 2}), StaticShape({10, 8, 2, 8})), make_tuple(StaticShape({3, 1, 4, 3, 4}), StaticShape({3, 2, 1, 4, 1}))), + // make_tuple(StaticShape({1}), StaticShape({1, 3})), + // make_tuple(StaticShape({1}), StaticShape({1, 1, 3})), + // make_tuple(StaticShape({3, 1}), StaticShape({1})), + // make_tuple(StaticShape({3, 2, 1}), StaticShape({1})), + // make_tuple(StaticShape({2, 1, 2}), StaticShape({2, 6})), CPUMatMulTest::getTestCaseName); } // namespace cpu_shape_infer