SupportsDType#
- class brainstate.typing.SupportsDType(*args, **kwargs)[source]#
Protocol for objects that have a dtype property.
This protocol defines the interface for any object that exposes a dtype attribute, allowing for flexible type checking.
Examples
>>> def get_dtype(obj: SupportsDType) -> DType: ... return obj.dtype >>> >>> # Works with arrays >>> arr = jnp.array([1.0, 2.0]) >>> dtype = get_dtype(arr) # float32