Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/paddle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@
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
Expand Down
4 changes: 3 additions & 1 deletion python/paddle/autograd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
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']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1、兼容性影响较小,从__all__列表中删除只影响import *,相对使用很少。对于autograd.grad这类使用不受影响。
2、建议paddle.grad 修改从fluid import 改为从autograd import,fluid是非标准路径是计划会废弃的
3、包括no_grad、set_grad_enabled也建议从autograd import,这部分代码有计划从fluid迁移到autograd

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done