full_like¶
- full_like(x: array, /, fill_value: bool | int | float | complex, *, dtype: dtype | None = None, device: device | None = None) array ¶
Returns a new array filled with
fill_value
and having the sameshape
as an input arrayx
.- Parameters:
x (array) – input array from which to derive the output array shape.
fill_value (Union[bool, int, float, complex]) – fill value.
dtype (Optional[dtype]) –
output array data type. If
dtype
isNone
, the output array data type must be inferred fromx
. Default:None
.Note
If the
fill_value
exceeds the precision of the resolved output array data type, behavior is unspecified and, thus, implementation-defined.Note
If the
fill_value
has a data type which is not of the same data type kind (boolean, integer, or floating-point) as the resolved output array data type (see Type Promotion Rules), behavior is unspecified and, thus, implementation-defined.device (Optional[device]) – device on which to place the created array. If
device
isNone
, the output array device must be inferred fromx
. Default:None
.
- Returns:
out (array) – an array having the same shape as
x
and where every element is equal tofill_value
.
Notes
Changed in version 2022.12: Added complex data type support.