empty_like#
- class brainunit.math.empty_like(prototype, dtype=None, shape=None, unit=Unit('1'))#
Return a new uninitialized quantity or array with the same shape and type as a given array.
- Parameters:
prototype (saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex) – The shape and data-type ofprototypedefine these same attributes of the returned array.dtype (
str|type[Any] |dtype|SupportsDType|None) – Overrides the data type of the result.shape (
int|Sequence[int]) – Overrides the shape of the result. If not given,prototype.shapeis used.unit (saiunit.Unit) – Unit of the returned
Quantity.
- Returns:
out – Array of uninitialized (arbitrary) data with the same shape and type as
prototype.- Return type:
saiunit.Quantity |
Array
Examples
>>> import saiunit as u >>> import jax.numpy as jnp >>> result = u.math.empty_like(jnp.array([1.0, 2.0, 3.0])) >>> result.shape (3,)