提交 85205ea8 编写于 作者: P panyifeng

fix document example for insert_grad_of

上级 549bfb97
......@@ -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))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册