flopscope.

flopscope.numpy.isdtype

fnp.isdtype(dtype, kind)[flopscope source][numpy source]

Determine if a provided dtype is of a specified data type ``kind``.

Adapted from NumPy docs np.isdtype

Areacore
Typefree
NumPy Refnp.isdtype
Cost
0
Flopscope Context

Return True if array or dtype is of specified kind (NumPy 2.x).

Determine if a provided dtype is of a specified data type kind.

This function only supports built-in NumPy's data types. Third-party dtypes are not yet supported.

Parameters

dtype:dtype

The input dtype.

kind:dtype or str or tuple of dtypes/strs.

dtype or dtype kind. Allowed dtype kinds are: * 'bool' : boolean kind * 'signed integer' : signed integer data types * 'unsigned integer' : unsigned integer data types * 'integral' : integer data types * 'real floating' : real-valued floating-point data types * 'complex floating' : complex floating-point data types * 'numeric' : numeric data types

Returns

out:bool

See also

Examples

>>> import flopscope.numpy as fnp
>>> flops.isdtype(flops.float32, flops.float64)
False
>>> flops.isdtype(flops.float32, "real floating")
True
>>> flops.isdtype(flops.complex128, ("real floating", "complex floating"))
True