mindspore.numpy.full
- mindspore.numpy.full(shape, fill_value, dtype=None)[source]
Returns a new tensor of given shape and type, filled with fill_value.
- Parameters
shape (Union[int, tuple(int), list(int)]) – Shape of the new tensor, e.g., \((2, 3)\) or \(2\).
fill_value (Union[int, float, bool, list, tuple]) – Scalar or array_like fill value.
dtype (Union[
mindspore.dtype
, str], optional) – Designated tensor dtype, if dtype isNone
, the data type of the new tensor will be inferred from fill_value. Default isNone
.
- Returns
Tensor, with the designated shape and dtype, filled with fill_value.
- Raises
TypeError – If input arguments have types not specified above.
ValueError – If shape has entries < 0.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore.numpy as np >>> print(np.full((2,2), True)) [[True True] [True True]]