megengine.functional.full_like¶
- full_like(inp, value)[源代码]¶
返回一个与输入张量形状相同的且值为给定值的零张量
- 参数
inp (Tensor) – input tensor from which to derive the output tensor shape.
value (Scalar) – fill value.
- 返回类型
- 返回
a tensor having the same shape as input tensor and where every element is equal to fill value.
实际案例
>>> 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)