Use dtype.kind
@@ -28,7 +28,7 @@ def iscomplex(x):
return numpy.iscomplex(x)
if not isinstance(x, cupy.ndarray):
return cupy.asarray(numpy.iscomplex(x))
- if issubclass(x.dtype.type, numpy.complexfloating):
+ if x.dtype.kind == 'c':
return x.imag != 0
return cupy.zeros(x.shape, bool)
@@ -59,7 +59,7 @@ def iscomplexobj(x):
"""
if not isinstance(x, cupy.ndarray):
return numpy.iscomplexobj(x)
- return issubclass(x.dtype.type, numpy.complexfloating)
+ return x.dtype.kind == 'c'
def isfortran(a):
@@ -149,7 +149,7 @@ def isreal(x):
return numpy.isreal(x)
if not isinstance(x, cupy.ndarray):
return cupy.asarray(numpy.isreal(x))
- if issubclass(x.dtype.type, numpy.complexfloating):
+ if x.dtype.kind == 'c':
return x.imag == 0
return cupy.ones(x.shape, bool)
@@ -180,4 +180,4 @@ def isrealobj(x):
"""
if not isinstance(x, cupy.ndarray):
return numpy.isrealobj(x)
- return not issubclass(x.dtype.type, numpy.complexfloating)
+ return x.dtype.kind != 'c'
