diff --git a/tests/python/unittest/test_operator.py b/tests/python/unittest/test_operator.py index f2d8a1b2524f..78c8760bfb73 100644 --- a/tests/python/unittest/test_operator.py +++ b/tests/python/unittest/test_operator.py @@ -6990,6 +6990,20 @@ def test_float16_min_max(): assert np.finfo('float16').max == mx.nd.max(a).asscalar() +@with_seed() +def test_zero_sized_min_max(): + def min(): + a = mx.nd.zeros(shape=(5, 0)) + a.min() + + def max(): + a = mx.nd.zeros(shape=(5, 0)) + a.max() + + assert_raises(MXNetError, min) + assert_raises(MXNetError, max) + + @with_seed() def test_squeeze_op(): def check_squeeze_op(shape, axis=None):