brainunit.math.ones#
- brainunit.math.ones(shape, dtype=None, unit=Unit('1'))#
Return a new quantity or array of given shape and type, filled with ones.
- Parameters:
- Returns:
out – Array of ones with the given shape and dtype.
- Return type:
Array|Quantity
Examples
>>> import saiunit as u >>> u.math.ones((3,)) Array([1., 1., 1.], dtype=float32) >>> u.math.ones((2, 2), unit=u.meter) Quantity([[1. 1.] [1. 1.]], "m")