diff --git a/docs/api/api_python/nn/mindspore.nn.Cell.rst b/docs/api/api_python/nn/mindspore.nn.Cell.rst index 2b2bfae667b..4c2902e0aca 100644 --- a/docs/api/api_python/nn/mindspore.nn.Cell.rst +++ b/docs/api/api_python/nn/mindspore.nn.Cell.rst @@ -339,7 +339,7 @@ **返回:** - - **handle** – 与hook_fn函数对应的handle对象。 + `mindspore.common.hook_handle.HookHandle` 类型,与 `hook_fn` 函数对应的 `handle` 对象。可通过调用 `handle.remove()` 来删除添加的 `hook_fn` 函数。 **异常:** @@ -362,7 +362,7 @@ **返回:** - - **handle** – 与hook_fn函数对应的handle对象。 + `mindspore.common.hook_handle.HookHandle` 类型,与 `hook_fn` 函数对应的 `handle` 对象。可通过调用 `handle.remove()` 来删除添加的 `hook_fn` 函数。 **异常:** @@ -385,7 +385,7 @@ **返回:** - - **handle** – 与hook_fn函数对应的handle对象。 + `mindspore.common.hook_handle.HookHandle` 类型,与 `hook_fn` 函数对应的 `handle` 对象。可通过调用 `handle.remove()` 来删除添加的 `hook_fn` 函数。 **异常:** diff --git a/mindspore/python/mindspore/nn/cell.py b/mindspore/python/mindspore/nn/cell.py index 261bd3a3748..ed67669e9b1 100755 --- a/mindspore/python/mindspore/nn/cell.py +++ b/mindspore/python/mindspore/nn/cell.py @@ -1674,7 +1674,8 @@ class Cell(Cell_): hook_fn (function): Python function. Forward pre hook function. Returns: - - **handle** - The handle corresponding to the 'hook_fn'. + Handle, it is an instance of `mindspore.common.hook_handle.HookHandle` and corresponding to the `hook_fn` . + The handle can be used to remove the added `hook_fn` by calling `handle.remove()` . Raises: TypeError: If the `hook_fn` is not a function of python. @@ -1774,7 +1775,8 @@ class Cell(Cell_): hook_fn (function): Python function. Forward hook function. Returns: - - **handle** - The handle corresponding to the 'hook_fn'. + Handle, it is an instance of `mindspore.common.hook_handle.HookHandle` and corresponding to the `hook_fn` . + The handle can be used to remove the added `hook_fn` by calling `handle.remove()` . Raises: TypeError: If the `hook_fn` is not a function of python. @@ -1879,7 +1881,8 @@ class Cell(Cell_): hook_fn (function): Python function. Backward hook function. Returns: - - **handle** - The handle corresponding to the 'hook_fn'. + Handle, it is an instance of `mindspore.common.hook_handle.HookHandle` and corresponding to the `hook_fn` . + The handle can be used to remove the added `hook_fn` by calling `handle.remove()` . Raises: TypeError: If the `hook_fn` is not a function of python.