full_like¶
- full_like(x: array, /, fill_value: int | float, *, 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[int, float]) – 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 (int
orfloat
) which is not of the same data type kind 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
.