megengine.functional.zeros_like¶
- zeros_like(inp)[源代码]¶
返回一个跟输入tensor拥有相同shape和dtype的全零tensor。
- 参数
inp (Tensor) – input tensor from which to derive the output tensor shape.
- 返回类型
- 返回
a tensor having the same shape as input tensor and filled with zeros.
实际案例
>>> x = F.arange(6, dtype='int32').reshape(2, 3) >>> F.zeros_like(x) Tensor([[0 0 0] [0 0 0]], dtype=int32, device=xpux:0)