Skip to content

Commit

Permalink
remove packages in __all__ (#32759)
Browse files Browse the repository at this point in the history
* [OPs] Bug fix, fix the segment mean for illegal syncthreads usage. (#32596) (#32610)

* [OPs] Bug fix, fix the segment mean for illegal syncthreads usage.

* remove packages in __all__

* create new public api level paddle.callbacks;paddle.hub;paddle.utils.unique_name

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
  • Loading branch information
zhiboniu and ZHUI authored May 7, 2021
1 parent 3753416 commit a77ade0
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 19 deletions.
6 changes: 2 additions & 4 deletions python/paddle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@

# high-level api
from .hapi import Model # noqa: F401
from .hapi import callbacks # noqa: F401
from . import callbacks # noqa: F401
from .hapi import summary # noqa: F401
from .hapi import flops # noqa: F401
from .hapi import hub # noqa: F401
from . import hub # noqa: F401

import paddle.text # noqa: F401
import paddle.vision # noqa: F401
Expand Down Expand Up @@ -335,10 +335,8 @@
'unsqueeze_',
'argmax',
'Model',
'callbacks',
'summary',
'flops',
'hub',
'sort',
'split',
'logical_and',
Expand Down
31 changes: 31 additions & 0 deletions python/paddle/callbacks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .hapi.callbacks import Callback # noqa: F401
from .hapi.callbacks import ProgBarLogger # noqa: F401
from .hapi.callbacks import ModelCheckpoint # noqa: F401
from .hapi.callbacks import VisualDL # noqa: F401
from .hapi.callbacks import LRScheduler # noqa: F401
from .hapi.callbacks import EarlyStopping # noqa: F401
from .hapi.callbacks import ReduceLROnPlateau # noqa: F401

__all__ = [ #noqa
'Callback',
'ProgBarLogger',
'ModelCheckpoint',
'VisualDL',
'LRScheduler',
'EarlyStopping',
'ReduceLROnPlateau'
]
5 changes: 1 addition & 4 deletions python/paddle/hapi/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@

from .progressbar import ProgressBar

__all__ = [
'Callback', 'ProgBarLogger', 'ModelCheckpoint', 'VisualDL', 'LRScheduler',
'EarlyStopping', 'ReduceLROnPlateau'
]
__all__ = []


def config_callbacks(callbacks=None,
Expand Down
21 changes: 21 additions & 0 deletions python/paddle/hub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .hapi.hub import list # noqa: F401
from .hapi.hub import help # noqa: F401
from .hapi.hub import load # noqa: F401

__all__ = [ #noqa
'list', 'help', 'load'
]
2 changes: 0 additions & 2 deletions python/paddle/nn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,8 @@ def weight_norm(*args):
'MaxPool3D',
'AdaptiveMaxPool2D',
'Hardshrink',
'clip',
'Softplus',
'KLDivLoss',
'clip_by_norm',
'AvgPool2D',
'L1Loss',
'LeakyReLU',
Expand Down
11 changes: 3 additions & 8 deletions python/paddle/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@
from .lazy_import import try_import # noqa: F401
from .op_version import OpLastCheckpointChecker # noqa: F401
from .install_check import run_check # noqa: F401
from ..fluid.framework import unique_name # noqa: F401
from . import unique_name # noqa: F401
from ..fluid.framework import require_version # noqa: F401

from . import download # noqa: F401
from . import image_util # noqa: F401
from . import cpp_extension # noqa: F401

__all__ = [ #noqa
'deprecated',
'download',
'run_check',
'unique_name',
'require_version',
'try_import'
__all__ = [ #noqa
'deprecated', 'run_check', 'require_version', 'try_import'
]
2 changes: 1 addition & 1 deletion python/paddle/utils/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
import logging
logger = logging.getLogger(__name__)

__all__ = []
__all__ = ['get_weights_path_from_url']

WEIGHTS_HOME = osp.expanduser("~/.cache/paddle/hapi/weights")

Expand Down
21 changes: 21 additions & 0 deletions python/paddle/utils/unique_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ..fluid.unique_name import generate # noqa: F401
from ..fluid.unique_name import switch # noqa: F401
from ..fluid.unique_name import guard # noqa: F401

__all__ = [ #noqa
'generate', 'switch', 'guard'
]

0 comments on commit a77ade0

Please sign in to comment.