megengine.functional.zeros_like#

zeros_like(inp)[source]#

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

Parameters:

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

Return type:

Tensor

Returns:

a tensor having the same shape as input tensor and filled with zeros.

Examples

>>> 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)