full

full(shape: int | Tuple[int, ...], fill_value: int | float, *, 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[int, float]) – fill value.

  • dtype (Optional[dtype]) –

    output array data type. If dtype is None, the output array data type must be inferred from fill_value. 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 floating-point data type. If the fill value is a bool, the output array must have 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.