brainunit.math.as_numpy

Contents

brainunit.math.as_numpy#

brainunit.math.as_numpy(x)#

Convert an array from any supported backend 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)