- ones_like(x: array, /, *, dtype: Optional[dtype] = None, device: Optional[device] = None) array ¶
Returns a new array filled with ones and having the same
shapeas an input array
x (array) – input array from which to derive the output array shape.
dtype (Optional[dtype]) – output array data type. If
None, the output array data type must be inferred from
device (Optional[device]) – device on which to place the created array. If
None, the output array device must be inferred from
out (array) – an array having the same shape as
xand filled with ones.