From e729006f8e6018bfbec04ec594c0b73f472fdd30 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Mon, 20 Apr 2020 15:28:42 +0800 Subject: [PATCH] docs(mge/python): add doc for zero_grad GitOrigin-RevId: bb5154c0e7280bfb3162d5a34c508df4c0be2847 --- python_module/megengine/functional/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python_module/megengine/functional/utils.py b/python_module/megengine/functional/utils.py index b490eb2f3..989505997 100644 --- a/python_module/megengine/functional/utils.py +++ b/python_module/megengine/functional/utils.py @@ -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) -- GitLab