megengine.functional.full_like#

full_like(inp, value)[source]#

Returns a tensor filled with given value with the same shape as input tensor.

Parameters:
  • inp (Tensor) – input tensor from which to derive the output tensor shape.

  • value (Scalar) – fill value.

Return type:

Tensor

Returns:

a tensor having the same shape as input tensor and where every element is equal to fill value.

Examples

>>> x = F.arange(6, dtype='int32').reshape(2, 3)
>>> F.full_like(x, 2)
Tensor([[2 2 2]
 [2 2 2]], dtype=int32, device=xpux:0)