ones¶
- ones(shape: int | Tuple[int, ...], *, dtype: dtype | None = None, device: device | None = None) array ¶
Returns a new array having a specified
shape
and filled with ones.- Parameters:
shape (Union[int, Tuple[int, ...]]) – output array shape.
dtype (Optional[dtype]) – output array data type. If
dtype
isNone
, the output array data type must be the default floating-point data type. Default:None
.device (Optional[device]) – device on which to place the created array. Default:
None
.
- Returns:
out (array) – an array containing ones.