From e6763609e0420afb62f6420cff782cd396ce2225 Mon Sep 17 00:00:00 2001 From: Wenyu Date: Wed, 12 May 2021 19:40:33 +0800 Subject: [PATCH] Fix comments in framework (#32861) * Fix comments in framework * Update framework.py --- python/paddle/framework/framework.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/paddle/framework/framework.py b/python/paddle/framework/framework.py index 17eaa82cd8b..93056a60c37 100644 --- a/python/paddle/framework/framework.py +++ b/python/paddle/framework/framework.py @@ -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 -- GitLab