megengine.functional.zeros_like

zeros_like(inp)[源代码]

Returns a tensor filled with zeros with the same shape and data type as input tensor.

参数

inp (Tensor) – 输入张量。

返回类型

Union[Tensor, SymbolVar]

返回

一个包含0的tensor。

实际案例

>>> input = F.arange(9, dtype='int32').reshape(3,3)
>>> F.zeros_like(input)
Tensor([[0 0 0]
 [0 0 0]
 [0 0 0]], dtype=int32, device=xpux:0)