Skip to content

Commit

Permalink
Merge pull request #8050 from asi1024/deprecate-type-aliases
Browse files Browse the repository at this point in the history
Remove usages of `numpy.float_` and `numpy.complex_`
  • Loading branch information
kmaehashi committed Feb 14, 2024
2 parents aa6356f + 0a631af commit 34f8edb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cupy/_core/_scalar.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ cdef object _numpy_float32 = numpy.float32
cdef object _numpy_float64 = numpy.float64
cdef object _numpy_complex64 = numpy.complex64
cdef object _numpy_complex128 = numpy.complex128
cdef object _numpy_float_ = numpy.float_
cdef object _numpy_complex_ = numpy.complex_
cdef object _numpy_float_ = numpy.float64
cdef object _numpy_complex_ = numpy.complex128


cpdef str get_typename(dtype):
Expand Down
4 changes: 2 additions & 2 deletions cupy/_core/core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ cdef class _ndarray_base:
>>> import cupy
>>> a = cupy.zeros((2,))
>>> i = cupy.arange(10000) % 2
>>> v = cupy.arange(10000).astype(cupy.float_)
>>> v = cupy.arange(10000).astype(cupy.float64)
>>> a[i] = v
>>> a # doctest: +SKIP
array([9150., 9151.])
Expand All @@ -1562,7 +1562,7 @@ cdef class _ndarray_base:
>>> import numpy
>>> a_cpu = numpy.zeros((2,))
>>> i_cpu = numpy.arange(10000) % 2
>>> v_cpu = numpy.arange(10000).astype(numpy.float_)
>>> v_cpu = numpy.arange(10000).astype(numpy.float64)
>>> a_cpu[i_cpu] = v_cpu
>>> a_cpu
array([9998., 9999.])
Expand Down
2 changes: 1 addition & 1 deletion tests/cupy_tests/random_tests/test_bit_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def check_seed(self, seed):
def test_seed_not_none(self, dtype):
self.check_seed(dtype(0))

@testing.for_dtypes([numpy.complex_])
@testing.for_dtypes([numpy.complex128])
def test_seed_invalid_type_complex(self, dtype):
with self.assertRaises(TypeError):
self.bg(dtype(0))
Expand Down
2 changes: 1 addition & 1 deletion tests/cupy_tests/random_tests/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def check_seed(self, seed):
def test_seed_not_none(self, dtype):
self.check_seed(dtype(0))

@testing.for_dtypes([numpy.complex_])
@testing.for_dtypes([numpy.complex128])
def test_seed_invalid_type_complex(self, dtype):
with self.assertRaises(TypeError):
self.rs.seed(dtype(0))
Expand Down

0 comments on commit 34f8edb

Please sign in to comment.