zeros_like#
- class brainunit.math.zeros_like(a, dtype=None, shape=None, unit=Unit('1'))#
Return a quantity or array of zeros with the same shape and type as a given array.
- Parameters:
a (saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex) – The shape and data-type ofadefine 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,a.shapeis used.unit (saiunit.Unit) – Unit of the returned
Quantity.
- Returns:
out – Array of zeros with the same shape and type as
a.- Return type:
saiunit.Quantity |
Array
Examples
>>> import saiunit as u >>> import jax.numpy as jnp >>> u.math.zeros_like(jnp.array([1.0, 2.0, 3.0])) Array([0., 0., 0.], dtype=float32) >>> u.math.zeros_like(jnp.array([1.0, 2.0]) * u.meter) Quantity([0. 0.], "m")