mindspore.ops.fill

View Source On Gitee
mindspore.ops.fill(type, shape, value)[source]

Create a tensor filled with a specified value.

Parameters
Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> mindspore.ops.fill(mindspore.float32, (2, 3),  1.2)
Tensor(shape=[2, 3], dtype=Float32, value=
[[ 1.20000005e+00,  1.20000005e+00,  1.20000005e+00],
 [ 1.20000005e+00,  1.20000005e+00,  1.20000005e+00]])