mindspore.ops.full_like

View Source On Gitee
mindspore.ops.full_like(input, fill_value, *, dtype=None)[source]

Return a tensor of the same shape as input and filled with a specified value.

Note

fill_value 's data type not support complex numbers.

Parameters
  • input (Tensor) – The input tensor.

  • fill_value (Number) – The specified value.

Keyword Arguments

dtype (mindspore.dtype, optional) – The data type specified. Default: None .

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> input = mindspore.ops.arange(4)
>>> mindspore.ops.full_like(input, 1.2)
Tensor(shape=[4], dtype=Int64, value= [1, 1, 1, 1])
>>> mindspore.ops.full_like(input, 1.2, dtype=mindspore.float32)
Tensor(shape=[4], dtype=Float32, value= [ 1.20000005e+00,  1.20000005e+00,  1.20000005e+00,  1.20000005e+00])