enable skipped test case of strideslice

remove default stride test

Signed-off-by: HU Yuan2 <yuan2.hu@intel.com>
This commit is contained in:
HU Yuan2 2023-08-07 16:36:42 +08:00
parent ae18cd84ef
commit a54f864027
2 changed files with 12 additions and 23 deletions

View File

@ -50,8 +50,15 @@ Result StridedSliceShapeInfer::infer(
if ((i >= shapeBegin[0]) || (shapeIn[i] == 0)) {
m_outputShape[new_idx] = shapeIn[i];
} else {
auto begin = m_begin_mask_set.count(i) ? 0 : beginPtr[i];
auto end = m_end_mask_set.count(i) ? shapeIn[i] : endPtr[i];
int32_t begin = 0;
int32_t end = 0;
if (stridePtr[i] < 0) {
begin = m_begin_mask_set.count(i) ? shapeIn[i] : beginPtr[i];
end = m_end_mask_set.count(i) ? (-1 - shapeIn[i]) : endPtr[i];
} else {
begin = m_begin_mask_set.count(i) ? 0 : beginPtr[i];
end = m_end_mask_set.count(i) ? shapeIn[i] : endPtr[i];
}
m_outputShape[new_idx] = ov::op::slice::get_sliced_value(shapeIn[i], begin, end, stridePtr[i]);
}
new_idx += 1;

View File

@ -106,29 +106,11 @@ INSTANTIATE_TEST_SUITE_P(
make_tuple(unit_test::ShapeVector{{3, 2, 3}, {3}, {3}, {3}}, std::vector<std::vector<int32_t>>{{1, 0, 0}, {0, 0, 0}, {1, 1, 1}},
std::vector<int64_t>{0, 1, 1}, std::vector<int64_t>(3, 1), StaticShape({2, 2, 3})),
make_tuple(unit_test::ShapeVector{{3, 2, 3}, {3}, {3}, {3}}, std::vector<std::vector<int32_t>>{{0, 1, 0}, {2, 0, 0}, {1, 1, 2}},
std::vector<int64_t>{1, 0, 1}, std::vector<int64_t>{0, 1, 1}, StaticShape({2, 1, 2}))),
// TODO 108946, can't pass;
// make_tuple(unit_test::ShapeVector{{3, 2, 3}, {3}, {3}, {3}}, std::vector<std::vector<int32_t>>{{0, 0, 0}, {1, 0, 0}, {1, 1, -1}},
// std::vector<int64_t>{0, 1, 1}, std::vector<int64_t>{0, 1, 1}, StaticShape({1, 1, 3}))),
std::vector<int64_t>{1, 0, 1}, std::vector<int64_t>{0, 1, 1}, StaticShape({2, 1, 2})),
make_tuple(unit_test::ShapeVector{{3, 2, 3}, {3}, {3}, {3}}, std::vector<std::vector<int32_t>>{{0, 0, 0}, {1, 0, 0}, {1, 1, -1}},
std::vector<int64_t>{0, 1, 1}, std::vector<int64_t>{0, 1, 1}, StaticShape({1, 2, 3}))),
StridedSliceCpuShapeInferenceTest::getTestCaseName);
TEST(CpuShapeInfer, StridedSliceDefault_stride) {
GTEST_SKIP() << "Skipping test, please check CVS-108946";
const auto mask = std::vector<int64_t>{0, 1, 0};
const auto data = std::make_shared<op::v0::Parameter>(element::f32, ov::PartialShape::dynamic());
// only supprot i32
const auto begin = op::v0::Constant::create(element::i32, ov::Shape{3}, {0, 0, 0});
const auto end = op::v0::Constant::create(element::i32, ov::Shape{3}, {1, 0, 2});
const auto op = std::make_shared<op::v1::StridedSlice>(data, begin, end, mask, mask);
std::vector<StaticShape> static_input_shapes = {{3, 2, 3}, {3}, {3}};
std::vector<StaticShape> static_output_shapes = {StaticShape{1, 2, 2}};
// implementation depends on some output information of the op
op->set_output_type(0, element::i32, {-1, -1, -1});
// TODO 108946,there is some issue in implementation, this test case can't pass
unit_test::cpu_test_shape_infer(op.get(), static_input_shapes, static_output_shapes);
}
} // namespace cpu_shape_infer
} // namespace unit_test
} // namespace intel_cpu