Add 0-length dimensions test for mean/std/var functions
@@ -179,3 +179,21 @@ class TestMeanVar(unittest.TestCase):
def test_external_std_axis_ddof(self, xp, dtype):
a = testing.shaped_arange((2, 3, 4), xp, dtype)
return xp.std(a, axis=1, ddof=1)
+
+ @testing.for_all_dtypes(no_complex=True)
+ @testing.numpy_cupy_allclose()
+ def test_external_mean_zero_len_axis(self, xp, dtype):
+ a = testing.shaped_arange((0, 0), xp, dtype)
+ return xp.mean(a, axis=1)
+
+ @testing.for_all_dtypes(no_complex=True)
+ @testing.numpy_cupy_allclose()
+ def test_external_var_zero_len_axis(self, xp, dtype):
+ a = testing.shaped_arange((0, 0), xp, dtype)
+ return xp.var(a, axis=1)
+
+ @testing.for_all_dtypes(no_complex=True)
+ @testing.numpy_cupy_allclose()
+ def test_external_std_zero_len_axis(self, xp, dtype):
+ a = testing.shaped_arange((0, 0), xp, dtype)
+ return xp.std(a, axis=1)
