mindspore.ops.full
- mindspore.ops.full(size, fill_value, *, dtype=None)[source]
Create a Tensor of the specified shape and fill it with the specified value.
- Parameters
- Keyword Arguments
dtype (mindspore.dtype) – The specified type of output tensor. bool_ and number are supported, for details, please refer to
mindspore.dtype
. Default:None
.- Returns
Tensor.
- Raises
TypeError – If size is not a tuple or list.
ValueError – The element in size is less than 0.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> from mindspore import ops >>> output = ops.full((2, 2), 1) >>> print(output) [[1. 1.] [1. 1.]] >>> output = ops.full((3, 3), 0) >>> print(output) [[0. 0. 0.] [0. 0. 0.] [0. 0. 0.]]