提交 e729006f 编写于 作者: M Megvii Engine Team 提交者: Xinran Xu

docs(mge/python): add doc for zero_grad

GitOrigin-RevId: bb5154c0e7280bfb3162d5a34c508df4c0be2847
上级 bb92ee26
......@@ -69,4 +69,12 @@ def accuracy(logits: Tensor, target: Tensor, topk: Union[int, Iterable[int]] = 1
@wrap_io_tensor
def zero_grad(inp: Tensor) -> Tensor:
r"""
Returns a tensor which is treated as constant during backward gradient calcuation,
i.e. its gradient is zero.
:param inp: Input tensor.
See implementation of :func:`~.softmax` for example.
"""
return mgb.opr.zero_grad(inp)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册