提交 520db818 编写于 作者: Asthestarsfalll's avatar Asthestarsfalll

docs(mge/functional): update functional.zeros_like docstring

上级 051a6055
......@@ -208,33 +208,20 @@ def zeros(shape, dtype="float32", device=None) -> Tensor:
def zeros_like(inp: Union[Tensor, SymbolVar]) -> Union[Tensor, SymbolVar]:
r"""Returns a zero tensor with the same shape as input tensor.
r"""Returns a tensor filled with zeros with the same shape and data type as input tensor.
Args:
inp: input tensor.
inp (Tensor): input tensor.
Return:
output tensor.
a tensor containing zeros.
Examples:
.. testcode::
import numpy as np
from megengine import tensor
import megengine.functional as F
inp = tensor(np.arange(1, 7, dtype=np.int32).reshape(2,3))
out = F.zeros_like(inp)
print(out.numpy())
Outputs:
.. testoutput::
[[0 0 0]
[0 0 0]]
>>> input = F.arange(9, dtype='int32').reshape(3,3)
>>> F.ones_like(input)
Tensor([[0 0 0]
[0 0 0]
[0 0 0]], dtype=int32, device=xpux:0)
"""
return full_like(inp, 0.0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册