From 61d961ddec3dc0942dea52ea49fd7f7e690e83f8 Mon Sep 17 00:00:00 2001 From: simson <526422051@qq.com> Date: Sat, 25 Jul 2020 15:01:10 +0800 Subject: [PATCH] Modify comment of register_backward_hook --- mindspore/nn/cell.py | 2 +- mindspore/ops/operations/debug_ops.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mindspore/nn/cell.py b/mindspore/nn/cell.py index 5e7e2017f5f..1dbaae2fa6e 100755 --- a/mindspore/nn/cell.py +++ b/mindspore/nn/cell.py @@ -862,7 +862,7 @@ class Cell: def register_backward_hook(self, fn): """ - Set the cell backward hook function. + Set the cell backward hook function. Note that this function is only supported in Pynative Mode. Note: fn should be defined as following code shows, `cell_name` is the name of registered cell, diff --git a/mindspore/ops/operations/debug_ops.py b/mindspore/ops/operations/debug_ops.py index 066791d4df5..03d9adfe8b4 100644 --- a/mindspore/ops/operations/debug_ops.py +++ b/mindspore/ops/operations/debug_ops.py @@ -251,7 +251,8 @@ class InsertGradientOf(PrimitiveWithInfer): class HookBackward(PrimitiveWithInfer): """ - Used as tag to hook gradient in intermediate variables. + Used as tag to hook gradient in intermediate variables. Note that this function + is only supported in Pynative Mode. Note: The hook function should be defined like `hook_fn(grad) -> Tensor or None`,