From 7d9ca164e4166947c6bd1bfc814bf441bc83a4b0 Mon Sep 17 00:00:00 2001 From: chentianyu03 Date: Thu, 16 Sep 2021 16:22:17 +0800 Subject: [PATCH] Remove autograd/grad api (#35579) * remove autograd/grad api * import grad, no_grad set_grad_enable from autograd module * modify import no_grad_ as no_grad --- python/paddle/__init__.py | 6 +++--- python/paddle/autograd/__init__.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/python/paddle/__init__.py b/python/paddle/__init__.py index 6d482785e95..0d7169251a7 100755 --- a/python/paddle/__init__.py +++ b/python/paddle/__init__.py @@ -255,9 +255,9 @@ from .framework import CUDAPlace # noqa: F401 from .framework import NPUPlace # noqa: F401 from .framework import CUDAPinnedPlace # noqa: F401 -from .framework import grad # noqa: F401 -from .framework import no_grad # noqa: F401 -from .framework import set_grad_enabled # noqa: F401 +from .autograd import grad # noqa: F401 +from .autograd import no_grad # noqa: F401 +from .autograd import set_grad_enabled # noqa: F401 from .framework import save # noqa: F401 from .framework import load # noqa: F401 from .framework import DataParallel # noqa: F401 diff --git a/python/paddle/autograd/__init__.py b/python/paddle/autograd/__init__.py index 569619f065a..89094357b35 100644 --- a/python/paddle/autograd/__init__.py +++ b/python/paddle/autograd/__init__.py @@ -16,5 +16,7 @@ from ..fluid.dygraph.base import grad # noqa: F401 from . import backward_mode # noqa: F401 from .backward_mode import backward # noqa: F401 from .py_layer import PyLayer, PyLayerContext # noqa: F401 +from ..framework import set_grad_enabled # noqa: F401 +from ..fluid.dygraph.base import no_grad_ as no_grad # noqa: F401 -__all__ = ['grad', 'backward', 'PyLayer', 'PyLayerContext'] +__all__ = ['backward', 'PyLayer', 'PyLayerContext'] -- GitLab