as_numpy

Contents

as_numpy#

class brainunit.math.as_numpy(x)#

Convert a JAX array (or Quantity) to a NumPy array.

Parameters:

x (Quantity or array_like) – The input to convert. If x is a Quantity, the underlying mantissa (in current unit scale) is returned as a NumPy array.

Returns:

out – NumPy array representation of x.

Return type:

numpy.ndarray

Examples

>>> import saiunit as u
>>> u.math.as_numpy(u.math.ones((3,)))
array([1., 1., 1.], dtype=float32)