mlx.core.full#

mlx.core.full(shape: Union[int, List[int]], vals: Union[scalar, array], dtype: Optional[Dtype] = None, *, stream: Union[None, Stream, Device] = None) array#

Construct an array with the given value.

Constructs an array of size shape filled with vals. If vals is an array it must be broadcastable to the given shape.

Parameters:
  • shape (int or list(int)) – The shape of the output array.

  • vals (float or int or array) – Values to fill the array with.

  • dtype (Dtype, optional) – Data type of the output array. If unspecified the output type is inferred from vals.

Returns:

The output array with the specified shape and values.

Return type:

array