fix output dtypes
@@ -368,7 +368,11 @@ class TestVectorizeStmts(unittest.TestCase):
f = xp.vectorize(func_if)
x = xp.array([1, 2, 3, 4, 5], dtype=xp.int64)
- return f(x)
+ out = f(x)
+ # On Windows, NumPy's default int type is int32, not int64
+ if sys.platform.startswith('win32') and out.dtype == xp.int32:
+ out = out.astype(xp.int64)
+ return out
@testing.numpy_cupy_array_equal()
def test_elif(self, xp):
@@ -382,7 +386,11 @@ class TestVectorizeStmts(unittest.TestCase):
f = xp.vectorize(func_if)
x = xp.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], dtype=xp.int64)
- return f(x)
+ out = f(x)
+ # On Windows, NumPy's default int type is int32, not int64
+ if sys.platform.startswith('win32') and out.dtype == xp.int32:
+ out = out.astype(xp.int64)
+ return out
@testing.numpy_cupy_array_equal()
def test_while(self, xp):
@@ -407,7 +415,11 @@ class TestVectorizeStmts(unittest.TestCase):
f = xp.vectorize(func_for)
x = xp.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], dtype=xp.int64)
- return f(x)
+ out = f(x)
+ # On Windows, NumPy's default int type is int32, not int64
+ if sys.platform.startswith('win32') and out.dtype == xp.int32:
+ out = out.astype(xp.int64)
+ return out
@testing.numpy_cupy_array_equal()
def test_for_const_range(self, xp):
@@ -467,7 +479,11 @@ class TestVectorizeStmts(unittest.TestCase):
f = xp.vectorize(func_for)
x = xp.array([0, 1, 2, 3, 4], dtype=xp.int64)
- return f(x, x)
+ out = f(x, x)
+ # On Windows, NumPy's default int type is int32, not int64
+ if sys.platform.startswith('win32') and out.dtype == xp.int32:
+ out = out.astype(xp.int64)
+ return out
@testing.numpy_cupy_array_equal()
def test_for_update_loop_condition(self, xp):
@@ -480,7 +496,11 @@ class TestVectorizeStmts(unittest.TestCase):
f = xp.vectorize(func_for)
x = xp.array([0, 1, 2, 3, 4], dtype=xp.int64)
- return f(x)
+ out = f(x)
+ # On Windows, NumPy's default int type is int32, not int64
+ if sys.platform.startswith('win32') and out.dtype == xp.int32:
+ out = out.astype(xp.int64)
+ return out
class _MyClass:
@@ -554,7 +574,7 @@ class TestVectorizeBroadcast(unittest.TestCase):
class TestVectorize(unittest.TestCase):
- @testing.for_dtypes('qQhfdFD')
+ @testing.for_dtypes('qQefdFD')
@testing.numpy_cupy_allclose(rtol=1e-5)
def test_vectorize_arithmetic_ops(self, xp, dtype):
def my_func(x1, x2, x3):
