full

full(shape: int | Tuple[int, ...], fill_value: bool | int | float | complex, *, dtype: dtype | None = None, device: device | None = None) array

Returns a new array having a specified shape and filled with fill_value.

Parameters:
  • shape (Union[int, Tuple[int, ...]]) – output array shape.

  • fill_value (Union[bool, int, float, complex]) – fill value.

  • dtype (Optional[dtype]) –

    output array data type. If dtype is None, the output array data type must be inferred from fill_value according to the following rules:

    • If the fill value is an int, the output array data type must be the default integer data type.

    • If the fill value is a float, the output array data type must be the default real-valued floating-point data type.

    • If the fill value is a complex number, the output array data type must be the default complex floating-point data type.

    • If the fill value is a bool, the output array must have a boolean data type. Default: None.

    Note

    If the fill_value exceeds the precision of the resolved default output array data type, behavior is left unspecified and, thus, implementation-defined.

  • device (Optional[device]) – device on which to place the created array. Default: None.

Returns:

out (array) – an array where every element is equal to fill_value.

Notes

Changed in version 2022.12: Added complex data type support.