未验证 提交 e6763609 编写于 作者: W Wenyu 提交者: GitHub

Fix comments in framework (#32861)

* Fix comments in framework

* Update framework.py
上级 85512d60
......@@ -96,11 +96,12 @@ def set_grad_enabled(mode):
Examples:
.. code-block:: python
import paddle
x = paddle.ones([3, 2])
x.stop_gradient = False
with torch.set_grad_enabled(False):
with paddle.set_grad_enabled(False):
y = x * 2
with torch.set_grad_enabled(True):
with paddle.set_grad_enabled(True):
z = x * 2
print(y.stop_gradient) # True
print(z.stop_gradient) # False
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册