Skip to content

Commit ef6a421

Browse files
committed
update 2.0 public api in all left files
1 parent 7cadd95 commit ef6a421

32 files changed

+174
-150
lines changed

python/paddle/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,8 @@
244244
from .framework import load # noqa: F401
245245
from .framework import DataParallel # noqa: F401
246246

247-
from .framework import set_default_dtype #DEFINE_ALIAS
248-
from .framework import get_default_dtype #DEFINE_ALIAS
249-
from .framework import set_grad_enabled #DEFINE_ALIAS
247+
from .framework import set_default_dtype # noqa: F401
248+
from .framework import get_default_dtype # noqa: F401
250249

251250
from .tensor.search import index_sample # noqa: F401
252251
from .tensor.stat import mean # noqa: F401
@@ -484,7 +483,6 @@
484483
'logical_not',
485484
'add_n',
486485
'minimum',
487-
'ComplexTensor',
488486
'scatter',
489487
'scatter_',
490488
'floor',
@@ -493,5 +491,6 @@
493491
'log2',
494492
'log10',
495493
'concat',
496-
'check_shape'
494+
'check_shape',
495+
'standard_normal'
497496
]

python/paddle/amp/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from .auto_cast import auto_cast
16-
from .grad_scaler import GradScaler
15+
from .auto_cast import auto_cast # noqa: F401
16+
from .grad_scaler import GradScaler # noqa: F401
1717

1818
__all__ = ['auto_cast', 'GradScaler']

python/paddle/amp/auto_cast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from paddle.fluid.dygraph.amp import amp_guard
1616

17-
__all__ = ['auto_cast']
17+
__all__ = []
1818

1919

2020
def auto_cast(enable=True, custom_white_list=None, custom_black_list=None):

python/paddle/amp/grad_scaler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from paddle.fluid.dygraph.amp import AmpScaler
1616

17-
__all__ = ['GradScaler']
17+
__all__ = []
1818

1919

2020
class GradScaler(AmpScaler):

python/paddle/autograd/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from ..fluid.dygraph.base import grad #DEFINE_ALIAS
16-
17-
from . import backward_mode
18-
from .backward_mode import backward
19-
from .py_layer import PyLayer, PyLayerContext
15+
from ..fluid.dygraph.base import grad # noqa: F401
16+
from . import backward_mode # noqa: F401
17+
from .backward_mode import backward # noqa: F401
18+
from .py_layer import PyLayer, PyLayerContext # noqa: F401
2019

2120
__all__ = ['grad', 'backward', 'PyLayer', 'PyLayerContext']

python/paddle/autograd/backward_mode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from paddle.fluid import core
1616
from paddle.fluid import framework
1717
import paddle
18-
__all__ = ['backward']
18+
__all__ = []
1919

2020

2121
@framework.dygraph_only

python/paddle/autograd/py_layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import paddle
1616
from paddle.fluid.framework import dygraph_only
1717
from paddle.fluid import core
18-
__all__ = ['PyLayer', 'PyLayerContext']
18+
__all__ = []
1919

2020

2121
class PyLayerContext(object):

python/paddle/batch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__all__ = ['batch']
15+
__all__ = []
1616

1717

1818
def batch(reader, batch_size, drop_last=False):
@@ -35,11 +35,11 @@ def batch(reader, batch_size, drop_last=False):
3535
Examples:
3636
.. code-block:: python
3737
38-
import paddle.fluid as fluid
38+
import paddle
3939
def reader():
4040
for i in range(10):
4141
yield i
42-
batch_reader = fluid.io.batch(reader, batch_size=2)
42+
batch_reader = paddle.batch(reader, batch_size=2)
4343
4444
for data in batch_reader():
4545
print(data)

python/paddle/compat.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@
1515
import six
1616
import math
1717

18-
__all__ = [
19-
'long_type',
20-
'to_text',
21-
'to_bytes',
22-
'round',
23-
'floor_division',
24-
'get_exception_message',
25-
]
18+
__all__ = []
2619

2720
if six.PY2:
2821
int_type = int

python/paddle/device.py

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,10 @@
1818
from paddle.fluid import core
1919
from paddle.fluid import framework
2020
from paddle.fluid.dygraph.parallel import ParallelEnv
21-
from paddle.fluid.framework import is_compiled_with_cuda #DEFINE_ALIAS
22-
from paddle.fluid.framework import is_compiled_with_rocm #DEFINE_ALIAS
23-
24-
__all__ = [
25-
'get_cudnn_version',
26-
'set_device',
27-
'get_device',
28-
'XPUPlace',
29-
'is_compiled_with_xpu',
30-
# 'cpu_places',
31-
# 'CPUPlace',
32-
# 'cuda_pinned_places',
33-
# 'cuda_places',
34-
# 'CUDAPinnedPlace',
35-
# 'CUDAPlace',
36-
'is_compiled_with_cuda',
37-
'is_compiled_with_rocm',
38-
'is_compiled_with_npu'
39-
]
21+
from paddle.fluid.framework import is_compiled_with_cuda # noqa: F401
22+
from paddle.fluid.framework import is_compiled_with_rocm # noqa: F401
23+
24+
__all__ = []
4025

4126
_cudnn_version = None
4227

@@ -68,7 +53,7 @@ def is_compiled_with_xpu():
6853
.. code-block:: python
6954
7055
import paddle
71-
support_xpu = paddle.device.is_compiled_with_xpu()
56+
support_xpu = paddle.is_compiled_with_xpu()
7257
"""
7358
return core.is_compiled_with_xpu()
7459

@@ -82,9 +67,10 @@ def XPUPlace(dev_id):
8267
8368
Examples:
8469
.. code-block:: python
85-
70+
# required: xpu
71+
8672
import paddle
87-
place = paddle.device.XPUPlace(0)
73+
place = paddle.XPUPlace(0)
8874
"""
8975
return core.XPUPlace(dev_id)
9076

0 commit comments

Comments
 (0)