mindspore.ops.Fill

class mindspore.ops.Fill[source]

Create a Tensor of the specified shape and fill it with the specified value.

Refer to mindspore.ops.fill() for more details.

Supported Platforms:

Ascend GPU CPU

Examples

>>> fill = ops.Fill()
>>> output = fill(mindspore.float32, (2, 2), 1)
>>> print(output)
[[1. 1.]
 [1. 1.]]
>>> output = fill(mindspore.float32, (3, 3), 0)
>>> print(output)
[[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]