Browse Source

!398 Fix misusing of non user function in doc example for insert_grad_of

Merge pull request !398 from penn/fix_example_doc_of_insert_grad_of
tags/v0.2.0-alpha
mindspore-ci-bot Gitee 6 years ago
parent
commit
abbd0bc504
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      mindspore/ops/operations/debug_ops.py

+ 2
- 1
mindspore/ops/operations/debug_ops.py View File

@@ -123,6 +123,7 @@ class InsertGradientOf(PrimitiveWithInfer):
>>> return ret
>>>
>>> clip = P.InsertGradientOf(clip_gradient)
>>> grad_all = C.GradOperation('get_all', get_all=True)
>>> def InsertGradientOfClipDemo():
>>> def clip_test(x, y):
>>> x = clip(x)
@@ -135,7 +136,7 @@ class InsertGradientOf(PrimitiveWithInfer):
>>> return clip_test(x, y)
>>>
>>> def fd(x, y):
>>> return C.grad_all(clip_test)(x, y)
>>> return grad_all(clip_test)(x, y)
>>>
>>> print("forward: ", f(1.1, 0.1))
>>> print("clip_gradient:", fd(1.1, 0.1))


Loading…
Cancel
Save