Skip to content

Commit

Permalink
update slice tests to use INT64_MIN instead of INT64_MAX end values i…
Browse files Browse the repository at this point in the history
…n most tests that have negative steps. disable CoreML EP if ONNX shape inferencing result doesn't match.
  • Loading branch information
edgchen1 committed Aug 17, 2023
1 parent 2efa90b commit 184054b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions onnxruntime/test/providers/cpu/tensor/slice_op.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ void RunSliceTest(const std::vector<int64_t>& input_dims,
SessionOptions so;
ASSERT_STATUS_OK(so.config_options.AddConfigEntry(kOrtSessionOptionsConfigStrictShapeTypeInference, "0"));

if (onnx_shape_disagreement) {
excluded_providers.insert(kCoreMLExecutionProvider);
}

if (!v10_only) {
OpTester testv9("Slice", 9);
testv9.AddAttribute("starts", starts);
Expand Down Expand Up @@ -548,7 +552,7 @@ TEST(SliceTest, Slice2D_ReverseAllAxes) {
RunSliceTest<float>({2, 2},
{1.0f, 2.0f, 3.0f, 4.0f},
{-1, -1},
{std::numeric_limits<int64_t>::max(), std::numeric_limits<int64_t>::max()},
{std::numeric_limits<int64_t>::min(), std::numeric_limits<int64_t>::min()},
{0, 1},
{-1, -1},
{2, 2},
Expand All @@ -565,7 +569,7 @@ TEST(SliceTest, Slice2D_ReverseSubsetOfAxes_1) {
RunSliceTest<float>({2, 2},
{1.0f, 2.0f, 3.0f, 4.0f},
{-1},
{std::numeric_limits<int64_t>::max()},
{std::numeric_limits<int64_t>::min()},
{1}, // axis = 1 only
{-1},
{2, 2},
Expand All @@ -582,7 +586,7 @@ TEST(SliceTest, Slice2D_ReverseSubsetOfAxes_2) {
RunSliceTest<float>({2, 2},
{1.0f, 2.0f, 3.0f, 4.0f},
{-1},
{std::numeric_limits<int64_t>::max()}, // end of dimension
{std::numeric_limits<int64_t>::min()}, // end of dimension
{0}, // axis = 0 only
{-1},
{2, 2},
Expand Down Expand Up @@ -636,7 +640,7 @@ TEST(SliceTest, Slice2D_ReverseSubsetOfNegAxes_1) {
RunSliceTest<float>({2, 2},
{1.0f, 2.0f, 3.0f, 4.0f},
{-1},
{std::numeric_limits<int64_t>::max()},
{std::numeric_limits<int64_t>::min()},
{-1}, // axis = -1 only
{-1},
{2, 2},
Expand Down

0 comments on commit 184054b

Please sign in to comment.