ones#

rbc.stdlib.creation_functions.ones(shape, dtype=None)#

Return a new array of given shape and type, filled with ones.

Examples

>>> from rbc.stdlib import array_api
>>> @heavydb('double[](int64)')
... def ones(size):
...     return array_api.ones(size)
>>> ones(3).execute()
array([1., 1., 1.], dtype=float32)
>>> @heavydb('int64[](int64)')
... def ones2(size):
...     return array_api.ones(size, 'int64')
>>> ones2(2).execute()
array([1, 1])

Array-API ‘ones’ doc