issubdtype

Contents

issubdtype#

class brainunit.math.issubdtype(a, b)#

Check if a dtype is a sub-dtype of another in the type hierarchy.

Parameters:
  • a (TypeVar(T)) – First dtype to check.

  • b (TypeVar(T)) – Second dtype (abstract type class or concrete dtype).

Returns:

outTrue if a is lower or equal in the type hierarchy to b.

Return type:

bool

Examples

>>> import jax.numpy as jnp
>>> import saiunit.math as sumath
>>> sumath.issubdtype(jnp.float32, jnp.floating)
True
>>> sumath.issubdtype(jnp.int32, jnp.floating)
False